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
{{ message }}
Repository navigation
Consider conformance guidance for authors to explicitly declare autofocus for dialog element #7709
As such, authors should use the autofocus attribute on the descendant element of the dialog that the user will expect to immediately interact with after the dialog opens. If there is no such element, then authors should use the autofocus attribute on the dialog element itself.
Summary of exchange between Domenic and Aaron:
This would mean conformance checkers will warn authors if a dialog element doesn't have autofocus specified somewhere in the dialog.
agreement that this is probably the right thing to do, but worry about potential warning fatigue or requiring redundant autofocus attributes.
This seems like a good thing to require if we think that making web developers think about and make a decision about which element should have autofocus results in a net better UX compared to the default behavior when there's no autofocus.
I'm not so worried about warning fatigue in this case, as long as the message in the conformance checker is understandable and explains the motivation for needing the autofocus attribute.
There's some precedence: the sizes attribute was optional at first and had a default value (100vw). We noticed that many developers omitted the sizes attribute (since it was optional) but the default was not always appropriate. So we made it required, even when you want the default value, and developers who wanted the error to go away had to think about what value to use in sizes.
Regarding the question of which issues in #4184 (comment) should be considered blocking for writing up a spec of https://github.com/whatwg/html/wiki/dialog--initial-focus,-a-proposal#initial-dialog-focus-logic : This is about whether to include a single sentence in the spec proposal there. And we have at least some positive support for including the sentence, from @zcorpan and the two thumbs-uppers. So I think we should call this resolved, and that sentence should be included in the PR.
You can learn more about authoring conformance requirements here: https://html.spec.whatwg.org/#conformance-requirements-for-authors . Searching for "Authors should" in the spec will turn up a few examples of the type we're talking about. For this requirement in particular, I think it's about just keeping the sentence mentioned in the OP, when rewriting the dialog element introduction section.
Activity
zcorpan commentedon Mar 31, 2022
This seems like a good thing to require if we think that making web developers think about and make a decision about which element should have
autofocusresults in a net better UX compared to the default behavior when there's noautofocus.I'm not so worried about warning fatigue in this case, as long as the message in the conformance checker is understandable and explains the motivation for needing the
autofocusattribute.There's some precedence: the
sizesattribute was optional at first and had a default value (100vw). We noticed that many developers omitted thesizesattribute (since it was optional) but the default was not always appropriate. So we made it required, even when you want the default value, and developers who wanted the error to go away had to think about what value to use insizes.domenic commentedon Aug 9, 2022
Regarding the question of which issues in #4184 (comment) should be considered blocking for writing up a spec of https://github.com/whatwg/html/wiki/dialog--initial-focus,-a-proposal#initial-dialog-focus-logic : This is about whether to include a single sentence in the spec proposal there. And we have at least some positive support for including the sentence, from @zcorpan and the two thumbs-uppers. So I think we should call this resolved, and that sentence should be included in the PR.
josepharhar commentedon Aug 16, 2022
Great! How do I make a conformance requirement/guidance? Is there an example I could copy?
Implement dialog initial focus proposal
domenic commentedon Aug 19, 2022
You can learn more about authoring conformance requirements here: https://html.spec.whatwg.org/#conformance-requirements-for-authors . Searching for "Authors should" in the spec will turn up a few examples of the type we're talking about. For this requirement in particular, I think it's about just keeping the sentence mentioned in the OP, when rewriting the dialog element introduction section.
josepharhar commentedon Aug 25, 2022
That sentence is now in the PR