From 3f59ce221446f9d6f2ca66a8f99937032c283906 Mon Sep 17 00:00:00 2001 From: Dan Robertson Date: Wed, 19 Jul 2023 02:50:51 -0400 Subject: [PATCH] Make focus() always center the element it scrolls into view Previously, the inline position was implementation-defined, whereas the block position was centered. Now, they are both centered. Fixes #9518. Also updates to use CSSOM View's new "scroll a target into view" algorithm, which replaces the broken link to "scroll an element into view" that we were previously trying to invoke. --- source | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/source b/source index fe1e08e8740..6ceabc99976 100644 --- a/source +++ b/source @@ -3940,7 +3940,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
  • run the resize steps
  • run the scroll steps
  • evaluate media queries and report changes
  • -
  • Scroll an element into view
  • +
  • Scroll a target into view
  • Scroll to the beginning of the document
  • The resize event
  • The scroll event
  • @@ -67686,7 +67686,7 @@ try {
  • Let notionalChild be a hypothetical element that is a rendered child of the canvas element whose dimensions are those of specifiedRectangle.

  • -
  • Scroll notionalChild into +

  • Scroll notionalChild into view with behavior set to "auto", block set to "start", and inline set to "nearest".

    @@ -78976,10 +78976,8 @@ partial interface Navigator {
  • If the value of the preventScroll dictionary member of - options is false, then scroll the element - into view with scroll behavior "auto", block flow direction - position set to an implementation-defined value, and inline base direction position - set to an implementation-defined value.

  • + options is false, then scroll the element + into view given "auto", "center", and "center".

  • Unmark the element as locked for focus.

  • @@ -99747,7 +99745,7 @@ location.href = '#foo';
  • Run the ancestor hidden-until-found revealing algorithm on target.

  • -
  • Scroll target into view, +

  • Scroll target into view, with behavior set to "auto", block set to "start", and inline set to "nearest".