Title: Twenty Twenty: animated scroll changes in WordPress 5.3.1
Author: Jb Audras
Published: December 8, 2019

---

 [  ](https://profiles.wordpress.org/audrasjb/) [Jb Audras](https://profiles.wordpress.org/audrasjb/)
4:07 pm _on_ December 8, 2019     
Tags: [5.3.1 ( 6 )](https://make.wordpress.org/core/tag/5-3-1/),
[accessibility ( 59 )](https://make.wordpress.org/core/tag/accessibility/), [bundled-theme ( 84 )](https://make.wordpress.org/core/tag/bundled-theme/),
[core-css ( 192 )](https://make.wordpress.org/core/tag/core-css/), [dev-notes ( 650 )](https://make.wordpress.org/core/tag/dev-notes/),
[twentytwenty ( 6 )](https://make.wordpress.org/core/tag/twentytwenty/)   

# Twenty Twenty: animated scroll changes in WordPress 5.3.1

In WordPress 5.3, Twenty Twenty new bundled theme added smooth scroll animations
to anchor links. These animations were handled by native JavaScriptJavaScript JavaScript
or JS is an object-oriented computer programming language commonly used to create
interactive effects within web browsers. WordPress makes extensive use of JS for
a better user experience. While PHP is executed on the server, JS executes within
a user’s browser. [https://www.javascript.com](https://www.javascript.com/) and 
it caused several issues, mentioned in the following TracTrac An open source project
by Edgewall Software that serves as a bug tracker and project management tool for
WordPress. tickets and GitHubGitHub GitHub is a website that offers online implementation
of git repositories that can easily be shared, copied and modified by other developers.
Public repositories are free to host, private repositories require a paid subscription.
GitHub introduced the concept of the ‘pull request’ where code changes done in branches
by contributors can be reviewed and discussed before being merged by the repository
owner. [https://github.com/](https://github.com/) issues:

 * [#48763](https://core.trac.wordpress.org/ticket/48763) – Twenty Twenty: SmoothScroll
   is broken
 * [#48551](https://core.trac.wordpress.org/ticket/48551) – Twenty Twenty: Replace
   JSJS JavaScript, a web scripting language typically executed in the browser. 
   Often used for advanced user interfaces and behaviors.-based smooth scroll with
   CSSCSS Cascading Style Sheets.
 * [#48866](https://core.trac.wordpress.org/ticket/48866) – TwentyTwenty: Paginated
   comments don’t work
 * [GitHub issue 476](https://github.com/WordPress/twentytwenty/issues/476) – Consider
   removing JS-based smooth scroll

Additionally to the multiple issues listed in the above tickets, JavaScript-based
scroll animations add a bunch of relatively complex JS code, override natural anchor
behavior and may interfere with how specific user agents handle in-page scrolling.

**In WordPress 5.3.1, the current smooth scroll JavaScript implementation will be
replaced with “scroll-behavior” CSS property.**

This change fixes the issues encountered with the current JavaScript implementation,
and also includes an accessibilityAccessibility Accessibility (commonly shortened
to a11y) refers to the design of products, devices, services, or environments for
people with disabilities. The concept of accessible design ensures both “direct 
access” (i.e. unassisted) and “indirect access” meaning compatibility with a person’s
assistive technology (for example, computer screen readers). (https://en.wikipedia.
org/wiki/Accessibility) enhancementenhancement Enhancements are simple improvements
to WordPress, such as the addition of a hook, a new feature, or an improvement to
an existing feature. by using `prefers-reduced-motion: reduce` media query property
for users that have opted in to reduced motion in their browser settings.

For further explanation on this media query, [see Mozilla Developer Network documentation](https://developer.mozilla.org/en-US/docs/Web/CSS/scroll-behavior#Accessibility_concerns).

Browsers that don’t support `scroll-behavior` CSS property will fallback to default
HTMLHTML HyperText Markup Language. The semantic scripting language primarily used
for outputting content in web browsers. anchor behavior. For reference, [see full browsers support for this CSS property on MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/scroll-behavior#Browser_compatibility).

New CSS scroll animation implementation in Twenty Twenty:

    ```notranslate
    html {
        scroll-behavior: smooth;
    }
    @media (prefers-reduced-motion: reduce) {
        html {
            scroll-behavior: auto;
        }
    }
    ```

Developers are able to remove `scroll-behavior` effect on specific elements by using
a class CSS selector, as follows:

    ```notranslate
    .disable-smooth-scrolling {
        scroll-behavior: auto;
    }
    ```

For reference, [see the related changeset in 5.3.1 branch](https://core.trac.wordpress.org/changeset/46824).

[#5-3-1](https://make.wordpress.org/core/tag/5-3-1/), [#accessibility](https://make.wordpress.org/core/tag/accessibility/),
[#bundled-theme](https://make.wordpress.org/core/tag/bundled-theme/), [#core-css](https://make.wordpress.org/core/tag/core-css/),
[#dev-notes](https://make.wordpress.org/core/tag/dev-notes/), [#twentytwenty](https://make.wordpress.org/core/tag/twentytwenty/)

### Share this:

 * [  Threads ](https://make.wordpress.org/core/2019/12/08/twenty-twenty-animated-scroll-changes-in-wordpress-5-3-1/?share=threads)
 * [  Mastodon ](https://make.wordpress.org/core/2019/12/08/twenty-twenty-animated-scroll-changes-in-wordpress-5-3-1/?share=mastodon)
 * [  Bluesky ](https://make.wordpress.org/core/2019/12/08/twenty-twenty-animated-scroll-changes-in-wordpress-5-3-1/?share=bluesky)
 * [  X ](https://make.wordpress.org/core/2019/12/08/twenty-twenty-animated-scroll-changes-in-wordpress-5-3-1/?share=x)
 * [  Facebook ](https://make.wordpress.org/core/2019/12/08/twenty-twenty-animated-scroll-changes-in-wordpress-5-3-1/?share=facebook)
 * [  LinkedIn ](https://make.wordpress.org/core/2019/12/08/twenty-twenty-animated-scroll-changes-in-wordpress-5-3-1/?share=linkedin)

 1. ![](https://secure.gravatar.com/avatar/f274569400b5209071694894c9ed688cbb1477025acc1642d5ac8f8a3350061b?
    s=32&d=mm&r=g)
 2.  [Csaba (LittleBigThings)](https://profiles.wordpress.org/littlebigthing/)  5:46
    pm _on_ December 8, 2019
 3. Great decision! 👍

Comments are closed.

# Post navigation

[← Update: 9 Projects for 2019](https://make.wordpress.org/core/2019/12/06/update-9-projects-for-2019/)

[Proposed JavaScript Coding Standards Revisions for Prettier Compatibility →](https://make.wordpress.org/core/2019/12/09/proposed-javascript-coding-standards-revisions-for-prettier-compatibility/)