The issue involves React's focus management within HTML dialog elements.
The issue describes a bug where `autoFocus` does not work correctly inside `<dialog />` elements when using React. The problem is reproducible and has a clear expected behavior based on HTML specifications. The fix likely requires understanding React's focus management and how it interacts with native browser behavior.
React version: 17 and 18.0.0-rc.0-next-27b569969-20220211
<input /><input autoFocus /> inside <dialog />showModal() method of the dialog
Link to code example:
https://codesandbox.io/s/dreamy-meninsky-460wbr?file=/src/App.tsx
In Chrome and Safari TP the element with autofocus="true" will receive focus.
However the element with autoFocus={true} will not receive focus.
From the html-spec https://html.spec.whatwg.org/multipage/interaction.html#the-autofocus-attribute
The autofocus content attribute allows the author to indicate that an element is to be focused [...] as soon as the dialog within which it finds itself is shown
From https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autofocus
The au
Claim this issue to let others know you're working on it. You'll earn 10 points when you complete it!