-
Notifications
You must be signed in to change notification settings - Fork 3k
Implement dialog initial focus proposal #8199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This implements the changes proposed here: https://github.com/whatwg/html/wiki/dialog--initial-focus,-a-proposal#dialog-draft-text Specifically: 1. Add a parameter to dialog.show() called preventInitialFocus, which prevents the dialog focusing steps from running. 2. Make the dialog focusing steps look at sequentially focusable elements instead of any focusable element. There are additional open issues around dialog initial focus listed here: whatwg#4184 (comment) TODO add a conformance requirement about autofocus: whatwg#7709 TODO consider adding a <p class=XXX> for tab trapping: whatwg#7707
domenic
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
This does not implement the change where calling
showModal()on<dialog autofocus>will cause the dialog itself to get focus. Probably the best way to spec that is to change theshowModal()spec to check for the autofocus attribute and, if present, focus the dialog instead of going into the focus delegate steps. -
A big part of the proposal was writing up https://github.com/whatwg/html/wiki/dialog--initial-focus,-a-proposal#improving-conformance-requirements-and-examples as spec text, to replace the current single sentence "The dialog element represents a part of an application that a user interacts with to perform a task, for example a dialog box, inspector, or window."
Ah thanks, I totally missed this. It is now in the PR |
I added a commit to do this. Instead of doing it all in showModal I changed the dialog focusing steps because I figured that it would still be important to run the other autofocus related steps at the end of the dialog focusing steps |
| application, or manually closed by the user.</p> | ||
|
|
||
| <p>Especially for modal dialogs, which are a familiar pattern across all types of applications, | ||
| authors should work to ensure that dialogs in their web applications behave in a way that is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this intended to be non-normative? If so, don't use "should".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I intended this to be normative when I wrote it. Do you think it's a bad normative requirement, e.g. because it's too vague? I'm not sure on the precedent there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay. Yes, I think it's not a good requirement because it's vague and not testable. Further, the wording "authors should work to ensure" makes the requirement about the work the author does, which is a bit off.
If it's not testable, I think making it non-normative is better. e.g. s/should work/are encouraged/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see any remaining normative text in the section we're talking about, so I think this is resolved?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This paragraph is still there and still says "authors should work to ensure".
Perhaps we could just change it to "authors are encouraged"?
| application, or manually closed by the user.</p> | ||
|
|
||
| <p>Especially for modal dialogs, which are a familiar pattern across all types of applications, | ||
| authors should work to ensure that dialogs in their web applications behave in a way that is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I intended this to be normative when I wrote it. Do you think it's a bad normative requirement, e.g. because it's too vague? I'm not sure on the precedent there.
|
Thanks for the review @domenic! I believe I've addressed all your comments |
This implements the changes proposed here:
https://github.com/whatwg/html/wiki/dialog--initial-focus,-a-proposal#dialog-draft-text
Specifically:
autofocusattribute set.There are additional open issues around dialog initial focus listed here:
#4184 (comment)
(See WHATWG Working Mode: Changes for more details.)
/interaction.html ( diff )
/interactive-elements.html ( diff )