-
Notifications
You must be signed in to change notification settings - Fork 191
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
[popup] Add further clarity that popup is not (presently?) for modal dialogs #581
Comments
I think as a component author coming to see whether the Popup API is a good fit for specific components, having a good sense of where the Popup API is or is not a fit would be helpful. Things like:
Which would highlight the expected behavior. |
Is #1 inherent? I've been talking a bit to some other folks trying to understand the boundaries of popup use cases and whether or not popups were inherently popups, or they could be sometimes afforded that particular nature. For example, what about 'hamburger menus' - they are often just content, unless they are acting as a kind of popup because we've hidden the content by default. Or, in a form I might have some helpful text about what belongs in the field ("Your password must contain...") which we'd like to 'hint' one at a time on most devices, but... maybe if I had a reason to print that form I'd like to just display it inline. If either of those is potentially viable use cases for popup it seems to make #1 a complicated criteria to me. |
I think @mfreed7 mentioned that requirement (or was it more of a suggestion?) to me. Personally, I think it's reasonable for popup to serve use cases that are beyond just supporting content. I would love to hear other's thoughts. |
re:
does it overlay other content of the page and it would show/hide based on behaviors that are not commonly associated with the default semantics of the elements in question? e.g., a list of navigational links? Then that's a popup. if the hamburger navigation is shown/hidden in the normal flow of the document - e.g., does not render atop other content, then it is not a popup. similar to the form error messages (though, i would submit if they are not inline/persistent, then these would likely be problematic). re: the trigger that started this conversation - a modal dialog with light dismiss behavior is not a popup, as its modality and thus the inertness it applies to the underlying document make this distinct of popups. A popup generally should not be modal - particularly on desktop / larger viewports. However, a modeless dialog could be a popup indicating that this version of a dialog has light-dismiss behavior that is otherwise unexpected of a modeless dialog (as with other elements that can be popup but would not generally be expected to 'hide' upon focus leaving said elements). Interested to know if after all this time people have different understandings of popup. If so, we need to align on this - particularly since potential spec text is being written for the attribute.
i'd agree, but there's nuance there. Take Brian's hamburger navigation as an example. The navigation container would be persistent in this case - it doesn't represent "supporting" content - but it (the nav element) is also NOT the popup. The contents of the navigation could be provided popup behavior (so long as it actually did overlay atop other content). <nav>
<button type=button popuptoggletarget=f>Menu</button>
<ul id=f> <!-- all my links n' such --> </ul>
</nav> The reason being that you always want this navigation exposed. It is an important landmark for people using assistive technologies to quickly find the navigation content. The button within represents the trigger to toggle the contents of the navigation. the list contains the items - and is itself the popup. OR, a I guess, stepping back a bit, it depends on how you define "supporting content". Yes the list of links is the star content of the navigation element, but the navigation element itself is the main player here. Without it - this is just a list containing links. Why's that important? Oh, because it represents the content of the navigation. |
I see, so in your thinking the navigation hamburger is part of the proper "content" of the page, in that it's always visible, and the expanded display of the navigation hamburger menu's contents could reasonably be considered a popup, if those contents were rendered above content when in the shown state. I think that clarifies things for me |
First, thanks for this discussion - it'll be very important to have good developer guidance on when to think about
This is an interesting question to me: for the developer guidance I mention above, what distinguishes a non-modal
The last point is interesting: perhaps the most common application is |
|
Right, today it would throw. But it seems like perhaps it would be better if it didn’t? Maybe it should only throw if the dialog is already modal? |
It does feel like that's pretty subtle though for people to understand, and I wonder how it compares to something like Maybe we should open a distinct issue to think more about support for other non-modal UI components that perhaps already have some amount of browser standardization, like |
Please see #495, particularly this comment, which we resolved to accept, and which I'd really like to avoid re-opening. Essentially, the semantics (and therefore the Given the above, picking an element should primarily be about matching the semantics of the content. I.e. if you're building a "dialog", then you should pick the For me at least, <!-- This is a "dialog", so it should use a <dialog> element: -->
<dialog popup>I'm a "light dismiss" dialog</dialog>
<script>
const dialog = document.querySelector('dialog[popup]');
dialog.showModal(); // Please show me as a modal dialog!
dialog.close(); // Calling showPopUp while already modal *should* throw.
dialog.showPopUp(); // Please show me as a light-dismissible pop-up!
</script> It feels rather self-documenting, to me at least. Can you clarify what about the above feels wrong? Perhaps we can mitigate the wrongness somehow. |
I think what I'm feeling meh about is mostly the design of I guess in an ideal world what I'm looking for is: <dialog popup>I'm a "light dismiss dialog"</dialog>
<script>
const dialog = document.querySelector('dialog[popup]');
dialog.showModal(); // throws an error, because dialog is behaving as a popup, not a modal.
dialog.showPopUp(); // this is correct, because the dialog has been marked as a popup.
</script> And to make that feasible, dialog should be modal by default, or you could even introduce a new attribute modal or some other name that categorizes things that behave as modals, distinct from popups. <dialog modal>I'm a "modal" dialog</dialog>
<script>
const dialog = document.querySelector('dialog[modal]');
dialog.showPopUp(); // this should throw an error, the dialog is not a popup.
</script> Basically I think what I'm saying is that currently I guess there's probably some debate to be had as to whether you should allow overlapping behavior (and choose to be behave as either modal or popup) but my preference is that it's confusing and you should instead just pick one or the other. If you have multiple attributes like both |
this would have the potential to be dangerous. A dialog being non-modal by default is more forgiving of author error and more forgiving for users who may change the stylesheet of a site to make it more usable for them. An accidental |
Non-modal is a fine default too. My main issue here is not really suitable defaults, which clearly you have a better sense of than me. My main issue is that
|
I see your points, but I think the |
I'm fine if the I guess to close this up a bit:
To get back to the main thrust of this issue, is someone going to update the explainer to better reflect the design principles of popups, or is there more discussion to be had about what those principles are? |
Agree.
I think this makes a lot of sense. It seems like calling
I like this approach. Perhaps a new
We can do that. I think part of that guidance will actually need to be part of the spec PR, but that remains to be seen. I agree that this should be written down, because it's a popular question. |
So the leftover action item in this issue is simply to update the documentation and/or spec. Is that right? |
The largest change is the result of [this discussion](openui#581) about the differences between dialog and popup=manual. There's a new section attempting to describe those differences. This PR also includes recent changes to the `show` event, and an update on the interaction between top layer element types. This PR also removes an obsolete section of the `<selectmenu>` page that talks about replaceable shadow DOM.
PR to update the explainer is here: #593 Comments/reviews appreciated. |
The largest change is the result of [this discussion](openui#581) about the differences between dialog and popup=manual. There's a new section attempting to describe those differences. This PR also includes recent changes to the `show` event, and an update on the interaction between top layer element types. This PR also removes an obsolete section of the `<selectmenu>` page that talks about replaceable shadow DOM.
* Add recent OpenUI discussion results The largest change is the result of [this discussion](#581) about the differences between dialog and popup=manual. There's a new section attempting to describe those differences. This PR also includes recent changes to the `show` event, and an update on the interaction between top layer element types. This PR also removes an obsolete section of the `<selectmenu>` page that talks about replaceable shadow DOM. * Address comment * Address ::backdrop comment * Address comments Co-authored-by: Mason Freed <masonf@chromium.org>
Per discussion on the open ui discord initiated by @tbondwilkinson, there is some value in further identifying the differences between a "popup" and a "modal dialog" and why the disallowed elements section calls them out as not supporting popup.
Potentially adding to the goals section (or non-goals), examples, or even expanding the initial background section to help further clarify the differences between UI elements that "float" on screen and how not all floating content should be considered a "popup".
@tbondwilkinson please do add any of your thoughts here, as I'm sure my brief intro to the topic is not doing justice to your concerns.
The text was updated successfully, but these errors were encountered: