Skip to content

Consider conformance guidance for authors to explicitly declare autofocus for dialog element #7709

Closed

Description

@scottaohara

Per the dialog initial focus proposal, this unresolved comment has been moved here for further discussion:

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.

cc @sideshowbarker for thoughts on the matter

Activity

  1. added
    topic: dialog
    on Mar 16, 2022
  2. added
    impacts documentation
    on Mar 31, 2022
  3. zcorpan commented on Mar 31, 2022

    @zcorpan
    Member

    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.

  4. domenic commented on Aug 9, 2022

    @domenic
    Member

    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.

  5. josepharhar commented on Aug 16, 2022

    @josepharhar
    Contributor

    So I think we should call this resolved, and that sentence should be included in the PR

    Great! How do I make a conformance requirement/guidance? Is there an example I could copy?

  6. domenic commented on Aug 19, 2022

    @domenic
    Member

    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.

  7. josepharhar commented on Aug 25, 2022

    @josepharhar
    Contributor

    I think it's about just keeping the sentence mentioned in the OP

    That sentence is now in the PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    document conformanceimpacts documentationtopic: dialog

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions