fix(web-components): make sure autofocus works on all focusable custom elements during initial page load#36296
Draft
marchbox wants to merge 11 commits into
Draft
Conversation
📊 Bundle size report✅ No changes found |
|
Pull request demo site: URL |
a640148 to
a26abd9
Compare
autofocus works on TextInputautofocus works on all focusable custom elements
autofocus works on all focusable custom elementsautofocus works on all focusable custom elements during initial page load
19e8ddf to
b203948
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previous Behavior
All focusable components don’t work reliably with
autofocuson initial page load, due to the timing of when a element is defined and when the browser’s autofocus candidates flush process happens. See more details here: https://codepen.io/editor/marchbox/pen/019e9ab9-cd81-7c21-a3ae-1b7fe2d3458aNew Behavior
Adding a new artificial
element.focus()call inconnectedCallback(), so that the element gets focused if it hasautofocusattribute and no other element is focused on the page.Related Issue(s)
<fluent-text-input>#35944