Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> Warning: The tabindex attribute must not be used on the <dialog> element.

This really needs an explanation



"Why this is on MDN?" It is taken from the spec[0]:

> The tabindex attribute must not be specified on dialog elements.

Why is the spec like that? Uhh, I cannot find a source or explanation. If I had to GUESS, it is because it uses autofocus instead of tabindex to establish focus to the dialog when it is shown.

[0]https://html.spec.whatwg.org/multipage/interactive-elements....


Here's a long conversation on it from 2016: https://github.com/whatwg/html/issues/1929

It does seem to have something to do with interfering with automatic focus on the dialog when it pops up as a modal.


The only reason dialog suddenly shipped is because browsers want to remove alert/popup/confirm.

Until last year the spec for dialog was in such a state that Chrome (the only ones implementing it) argued that it should be removed.

IIRC literally none of the issues were fixed but suddenly it got shipped in all browsers.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: