From b4b0c03adcac79a8c7a78b10f72afaadee51f221 Mon Sep 17 00:00:00 2001 From: Joe Dolson Date: Sun, 16 Jul 2023 16:43:07 +0000 Subject: [PATCH] Help/About: Fix closing contextual help when scrolled. Change from `scrollIntoView` to `scrollIntoViewIfNeeded` so scrolling will only fire when it is required. `scrollIntoViewIfNeeded` is a proprietary method that is not standardized and not currently on a track towards standards. However, testing has it working well, including in Firefox, which supposedly does not support it. Props mikecho, studionashvegas, mai21, piotrek, Heiko_Mamerow, costdev, joedolson. Fixes #55342. git-svn-id: https://develop.svn.wordpress.org/trunk@56243 602fd350-edb4-49c9-b593-d223f7449a82 --- src/js/_enqueues/admin/common.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/js/_enqueues/admin/common.js b/src/js/_enqueues/admin/common.js index c2dfaaf99f..f85a9378ca 100644 --- a/src/js/_enqueues/admin/common.js +++ b/src/js/_enqueues/admin/common.js @@ -1407,8 +1407,8 @@ $( function() { * @return {void} */ $('#contextual-help-link, #show-settings-link').on( 'focus.scroll-into-view', function(e){ - if ( e.target.scrollIntoView ) - e.target.scrollIntoView(false); + if ( e.target.scrollIntoViewIfNeeded ) + e.target.scrollIntoViewIfNeeded(false); }); /**