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
This commit is contained in:
Joe Dolson 2023-07-16 16:43:07 +00:00
parent 9562f40776
commit b4b0c03adc

View File

@ -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);
});
/**