You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The above spec outlines that the first element with autofocus found in the DOM should be the one focused, and the others discarded ("flush autofocus candidates" steps 5.11.1 through 5.11.3).
However, the behavior of React's autoFocus polyfill is to set focus to the last element in the DOM with the attribute.
Ideally React's implementation should match the spec, behavior-wise.
The text was updated successfully, but these errors were encountered:
I've also been having issues with the polyfill in situations where the native autofocus="true" works as expected. However in my case (a modal with react-bulma), React's autoFocus polyfil doesn't work at all and the focus remains where it was before opening the modal.
Based on this comment: #11851 (comment), it appears
autoFocus
is meant to bring a consistent behavior to match HTML'sautofocus
.https://html.spec.whatwg.org/multipage/interaction.html#the-autofocus-attribute
The above spec outlines that the first element with
autofocus
found in the DOM should be the one focused, and the others discarded ("flush autofocus candidates" steps 5.11.1 through 5.11.3).However, the behavior of React's
autoFocus
polyfill is to set focus to the last element in the DOM with the attribute.Ideally React's implementation should match the spec, behavior-wise.
The text was updated successfully, but these errors were encountered: