Skip to content

Update dom-focus to specify the inline and block arguments to scroll a target into view#9527

Merged
domenic merged 2 commits into
whatwg:mainfrom
dlrobertson:dom-focus
Jul 19, 2023
Merged

Update dom-focus to specify the inline and block arguments to scroll a target into view#9527
domenic merged 2 commits into
whatwg:mainfrom
dlrobertson:dom-focus

Conversation

@dlrobertson

@dlrobertson dlrobertson commented Jul 17, 2023

Copy link
Copy Markdown
Member

Summary

  • All browsers currently use "center" for both inline and block (after bug 1842679). Update the definition of dom-focus to explicitly specify this. In addition, some web-platform-tests are written in a way that expects Element.focus() to focus an element to a certain scroll position.
  • Update usage of #scroll-an-element-into-view to scroll-a-target-into-view.

Checklist

FIxes: #9518


/browsing-the-web.html ( diff )
/canvas.html ( diff )
/infrastructure.html ( diff )
/interaction.html ( diff )

The "scroll an element into view definition" to "scroll a target into
view"

@domenic domenic left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work, thanks! We can count on this having multi-implementer interest since it just specifies what people are already doing.

Comment thread source Outdated
set to an <span>implementation-defined</span> value.</p></li>
<var>options</var> is false, then <span data-x="scroll a target into view">scroll the element
into view</span> with <var>behavior</var> set to "auto", <var>block</var> set to "center", and
<var>inline</var> set to "center".</p></li>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While you're here you could update this to modern style, which would be given "auto", "center", and "center". (Since the algorithm is not declared with named parameters.)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 good point

Remove the implementation defined behavior in the definition of the
block and inline arguments passed to scroll a target into view.

Fixes: whatwg#9518
@dlrobertson

Copy link
Copy Markdown
Member Author

Thanks for the feedback! Updated to use positional parameters

@domenic domenic merged commit 3f59ce2 into whatwg:main Jul 19, 2023
domenic pushed a commit to web-platform-tests/wpt that referenced this pull request Jul 19, 2023
@dlrobertson dlrobertson deleted the dom-focus branch July 19, 2023 10:58
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Jul 22, 2023
…element., a=testonly

Automatic update from web-platform-tests
Test that element.focus() centers the element

Follows whatwg/html#9527.
--

wpt-commits: 58c50ca94c3cdfd1932352df691ee632fed20145
wpt-pr: 41029
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request Jul 24, 2023
…element., a=testonly

Automatic update from web-platform-tests
Test that element.focus() centers the element

Follows whatwg/html#9527.
--

wpt-commits: 58c50ca94c3cdfd1932352df691ee632fed20145
wpt-pr: 41029

UltraBlame original commit: ebcfbf73b81b0a8f2ebba07509f092700c9c690b
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Jul 24, 2023
…element., a=testonly

Automatic update from web-platform-tests
Test that element.focus() centers the element

Follows whatwg/html#9527.
--

wpt-commits: 58c50ca94c3cdfd1932352df691ee632fed20145
wpt-pr: 41029

UltraBlame original commit: ebcfbf73b81b0a8f2ebba07509f092700c9c690b
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Jul 24, 2023
…element., a=testonly

Automatic update from web-platform-tests
Test that element.focus() centers the element

Follows whatwg/html#9527.
--

wpt-commits: 58c50ca94c3cdfd1932352df691ee632fed20145
wpt-pr: 41029

UltraBlame original commit: ebcfbf73b81b0a8f2ebba07509f092700c9c690b
jwidar pushed a commit to jwidar/LatencyZeroGithub that referenced this pull request Sep 16, 2025
…element., a=testonly

Automatic update from web-platform-tests
Test that element.focus() centers the element

Follows whatwg/html#9527.
--

wpt-commits: 58c50ca94c3cdfd1932352df691ee632fed20145
wpt-pr: 41029
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Define the block flow and inline base directions for dom-focus

2 participants