Repository navigation
Description
Per the dialog initial focus proposal, this unresolved comment has been moved here for further discussion. It's related to the topic of whether modeless dialogs should trap Tab key focus, but allow for users to navigate back and forth between the primary document and a modeless dialog or dialogs.
This issue could potentially replace issue 2171
Not really sure what to say about modeless dialogs. They're basically nonexistent on mobile, and rare on modern desktops. So it feels like the web kind of gets to define what they mean and how they're used. So probably the spec should say something about them... but what?
Google Docs on Android has a spell checker that works like a modeless dialog. You can navigate the text while keeping it open. The x button closes it. However, it does not gain initial focus, so in some ways you could just call it a panel. I guess this raises the question of, what's the difference between a modeless dialog and a panel? I think with a modeless dialog it's partly about the behavior you get for free:
- The AT alerts the user of its existence (this behavior comes for free via a dialog start event), and
- It has a soft navigation trap (it's possible to navigate away from it on purpose, but hard to escape it accidentally)
- Escape key dismisses it
In many cases an author could call something a panel, but dialogs feel more transitory. I think there seems to be an unfortunate fuzzy definition here.
(2) and (3) are not true in the current implementation, right? (3) we can easily add, but as discussed (2) is harder to add.
(1) is a strong differentiator.
I'll keep noodling on ideas on what to write here over the holidays, and revisit in the new year...
There are likely clarifications that the ARIA working group could assist with here, and may result in additions to role=dialog and aria-modal attribute
This is related to resolving ARIA issue 1284
Activity
scottaohara commentedon Mar 15, 2022
Related HTML AAM issue: w3c/html-aam#377
scottaohara commentedon Mar 15, 2022
Further discussion from the explainer pertaining to keyboard behavior:
@cookiecrook
@aleventhal
@scottaohara:
Related HTML issue concerning a native mechanism to navigate landmarks: #5813
[-]Clarify expectations for modeless dialogs[/-][+]Clarify UX (keyboard) and further a11y expectations for modeless dialogs[/+]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 : I don't think this is blocking. Modeless dialogs are challenging, but giving them the same focus semantics as modal dialogs seems like a reasonable starting point. (Plus maybe the mentioned additional ability of
dialog.show({ preventInitialFocus: true }).)domenic commentedon Aug 9, 2022
OK, I walk back that statement a little. This does block giving good advice in the conformance requirements section that was drafted at https://github.com/whatwg/html/wiki/dialog--initial-focus,-a-proposal#improving-conformance-requirements-and-examples . E.g. this issue is partially about what to substitute for that draft text where it says
and
Given how the current spec gives zero guidance on modeless dialogs, I think it would be tolerable to keep that state of affairs, and just have a
<p class="XXX">box linking to this issue or something. But it sure would be good if we had a story here we could tell web developers, at the same time as we unveil the new story for modal dialogs.That might be blocked on browser engineers giving a definite answer on whether they plan to implement a soft navigation trap of the sort discussed in the OP? I know Chromium has been wary of committing to that in the past, but it's probably worth a cross-browser discussion... I'll tag this as agenda+.
josepharhar commentedon Aug 16, 2022
It there's not already something in chromium that does tab trapping that we could copy, then yeah it would definitely require some work to build that functionality into FocusController. I don't think that's a reason to object to this though.
Implement dialog initial focus proposal
domenic commentedon Aug 24, 2022
We discussed this at the HTML triage meeting #8162. None of the implementers present were enthused about changing the behavior of modeless dialogs.
It was noted that
dialog.show()usage is quite low in Chromium (0.0012% of page views, versus 0.0260% forshowModal()), so it might be worth trying to remove it, especially since we could instead encourage the upcomingpopup=""API which is much clearer about how it can be integrated with various use patterns.Even if removal is not feasible, another path would be to "deprecate"
show()in spec-land, i.e. basically move it to an appendix and say authors must never use it. Then we don't have to describe any semantics or use cases for it; it's just a vestige of the platform which will never go away, but is no longer recommended, similar to<font>ordocument.all.Of course, this might just be a failure of imagination and experience. Perhaps modeless dialogs are a thriving pattern on the web (separate from the pop-up use cases) and we just haven't been able to find good examples. Toward this end, we'd love any thoughts from web developers on how modeless dialogs should work, and how well
dialogEl.show()works today.In the meantime, the tentative plan is that when we expand the authoring guidance in #8199, we'll have a box saying something like
josepharhar commentedon Aug 25, 2022
Would it be helpful if I added a console message when dialog.show() is called saying that we are planning to remove it and to come here if you'd like it to stay...?
The only reason I don't want to remove it is because it's extra work for me when websites break, but if the use counter is truly below the accepted threshold or whatever then maybe it would be easy to remove.
domenic commentedon Aug 26, 2022
I think that would only be worth doing if the group (and ideally the larger community) was affirmatively agreed to try to kill
dialog.show(), and you were willing to take on the extra work of driving the deprecation and removal process. So, I think we'd need to let this thread bake for a bit first, and then you'd have to do some soul-searching about whether it's worth the time investment to help clean up the web platform in such a way :).Historically, Chromium had a removal threshold of 0.03%, but that has been abandoned in favor of case-by-case judgments. Still, it's a nice indicator, that 0.0012% is a decent bit below that.
domenic commentedon Sep 5, 2022
I wonder why exactly we're adding
preventInitialFocusto modelessshow()in #8199, if we're not sure on the exact purpose of modeless dialogs in the first place, and are thinking about removing them?I recognize that https://github.com/whatwg/html/wiki/dialog--initial-focus,-a-proposal represents a lot of consensus-building work so I think the default path should be to keep that part of the proposal. But I am wondering if folks who were involved such as @aleventhal, @cookiecrook, @scottaohara, @mcking65, @jnurthen, etc. still believe
preventInitialFocusis an important part of the proposal.scottaohara commentedon Sep 8, 2022
preventInitialFocusmay not be as necessary anymore if a modeless dialog could be opened as apopup=manual. If specified as that and usingshowPopUp()to open, focus wouldn't go to the dialog by default then.mfreed7 commentedon Sep 8, 2022
Given the work on the pop-up API, which I believe is superior in a number of ways to modeless dialogs, I'm up for trying to deprecate
dialog.show(). That's assuming there's appetite from other implementers and the community, of course. But I'd want to try to make that decision soon, to avoid the usage going up before we deprecate it.lukewarlow commentedon Oct 6, 2023
Now that popover is out in 2 (and in progress in the third) engines, is it worth discussing again the idea of at least deprecating
.show()?Edit: just noticed #9376 sorry.
gregwhitworth commentedon Aug 17, 2026
@lukewarlow @scottaohara quickly skimming and reviewing the open issues; is there a reason to keep this issue open?
josepharhar commentedon Aug 17, 2026
I'm in favor of closing this, I don't think its worth trying to improve non-modal dialogs since we don't really recommend using them at the moment