[wp-trac] [WordPress Trac] #52116: Twenty Twenty: Menu + Search can cause a scroll jump on close

WordPress Trac noreply at wordpress.org
Mon Aug 12 17:02:25 UTC 2024


#52116: Twenty Twenty: Menu + Search can cause a scroll jump on close
-------------------------------------+-------------------------------------
 Reporter:  kjellr                   |       Owner:  (none)
     Type:  defect (bug)             |      Status:  new
 Priority:  normal                   |   Milestone:  Future Release
Component:  Bundled Theme            |     Version:
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch needs-testing  |     Focuses:  accessibility,
  2nd-opinion                        |  javascript
-------------------------------------+-------------------------------------
Changes (by sabernhardt):

 * keywords:  has-patch needs-testing needs-unit-tests 2nd-opinion => has-
     patch needs-testing 2nd-opinion
 * focuses:  javascript => accessibility, javascript


Comment:

 This is JavaScript, so I need someone else's opinion too :)

 The patch removes a lot, and at least some of it should remain.
 - The `clickedEl` lines were added to
 [https://github.com/WordPress/twentytwenty/issues/81 avoid focus loss],
 and those should be kept.
 - The modal needs to account for the admin toolbar height when users are
 logged in. With a new theme, subtracting `--wp-admin--admin-bar--height`
 could achieve that, but child themes can replace the stylesheet without
 replacing the JS.

 The comment above the event listener says
 > Hide the modal after a delay, so animations have time to play out.

 The jumping problem with in-page menu links seems to occur only when
 animations are turned off (`prefers-reduced-motion: reduce`). If so, the
 script could check for that media query and then either set the timeout to
 `0` or possibly even skip the `scrollTo` effect.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/52116#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list