[wp-trac] [WordPress Trac] #55143: Twenty Twenty One: focus position jumps when opening popup

WordPress Trac noreply at wordpress.org
Thu Sep 15 23:13:14 UTC 2022


#55143: Twenty Twenty One: focus position jumps when opening popup
-------------------------------+------------------------------
 Reporter:  paaljoachim        |       Owner:  (none)
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  Bundled Theme      |     Version:
 Severity:  normal             |  Resolution:
 Keywords:  reporter-feedback  |     Focuses:  javascript
-------------------------------+------------------------------

Comment (by joedolson):

 Reproduction steps:

 - Activate TwentyTwentyOne
 - Set up a primary menu. (This code is in `primary-navigation.js`, which
 is only enqueued with a menu.)
 - Create a link with an anchor, e.g. `<a id="test-target"
 href="#target">Target</a>` and a corresponding target, e.g. `<div
 id="target"></div>`
 - Add scripting to prevent the default event on the target, e.g.

 {{{
 var testTarget = document.getElementById( 'test-target' );
 testTarget.addEventListener( 'click', function(event) {
     event.preventDefault();
 });
 }}}

 Observe that although the event is attached, the page still scrolls to the
 target.

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


More information about the wp-trac mailing list