-
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
[popover] Dialog with popover-like triggers #741
Comments
Just saw #736, this might be a duplicate of that |
Happy to close my issue in favour of yours :) |
Text from my issue: This may end up being superseded by a more generic thing such as #700 But I think the modality aspect warrants this being a separate issue. Currently (well soon) non-modal Dialogs can be shown by using popover attribute. However, there's currently no way to load a modal dialog without using JS. This feels like a relatively simple but useful addition to the web. As a rough idea we could add a new This is perhaps odd considering we now have popover which almost does the exact same thing? |
I’m biased but I like option 2. I’m worried that |
Agreed, I would advise building these with I am not big on suggestion (1) (a new value for popover that adds modal behaviour), I feel it would make it harder to teach developers the difference between I like suggestion (2), to be it seems like a no-brainer! There is a related discussion over at whatwg/html#9167, where a more generic |
Could we declare the modality on the dialog itself rather than on the toggle? This fits the pattern of popovers better where the type of popover is declared in the popover attribute. Potentially dialog="modal"? Not sure if this is web compatible though. |
I would love if it could be as simple as:
|
I also had a discussion about this on #581. The feedback I got at the time was that popover was not intended to support dialog-like modals. I do think people will consistently reach for popover over dialog for modals, because of the new functionality. |
I'd like:
|
@jimmyfrasche I'm good with that too |
So I'm pasting a code example here from whatwg/html#3567 for clarity:
Don't you want to be able to use both popover and dialog with a single button? I know |
The Open UI Community Group just discussed The full IRC log of that discussion<gregwhitworth> Topic: [popover] Dialog with popover-like triggers<gregwhitworth> github: https://github.com//issues/741 <jarhar> una: this isnt a new topic, there are other issues that have been opened in whatwg and openui, how do we have declarative syntax for popover work for dialog <jarhar> una: popover=hint might work in this case <jarhar> una: we need clarity, there are perspective on what syntax would work like. not sure if whatwg is better for this discussion, just want to make sure we have thoughts on this <masonf> q+ <gregwhitworth> +1 on the popover API being solid <jarhar> una: i really like the syntax for popover and id love to use that for dialog, whether thats attributes or however we decide to have thoughts <gregwhitworth> q+ <JonathanNeal> solid? why not svelte.. kidding kidding kidding! <jarhar> una: i dont know if im looking for resolution, but should we discuss this here or in whatwg, and do we have an opinion on what this would look like <jarhar> masonf: i think it seems like a good place to start talking about it. i could see this moving more to whatwg if its a more general thing thats a bigger thing <jarhar> masonf: as it related to dialog thats good <jarhar> masonf: trying to conflate modality and popovers - i dont think that popover=modal is a good thing, thats what dialog elements are for <jarhar> masonf: id be in favor of a separate set of attributes for dialog which behaves in the same way <scotto> q+ <gregwhitworth> ack masonf <jarhar> una: i think theres a bit of overlap. when you use auto popovers you get backdrop, but you dont get the inerting of the rest of the page. i dont know if thats clear to someone that using popover, that theyre that different. <hdv> q+ <jarhar> una: we need to find a way to make those differences clear, make sure that people arent conflating them and are using each for the right use case <jarhar> una: its fine if we have unique attributes, different for dialog <jarhar> una: there are dialogs which are non-modal that woul dhave a different interaction with the ui, whats the difference between those and manual popovers <JonathanNeal> And I thought popover was just an ephemeral dialog. Oh no, is that a minority opinion? Sorry. <jarhar> masonf: cleanest is that we deprecate non-modal dialog, dialogs are always modal, always activate them with a single button <jarhar> una: any cases that youd want to use a non-modal dialog thats different from a popover <jarhar> masonf: you could put popover on any element, dont have to use dialog <jarhar> masonf: cant do that with a non-modal dialog because it has to be a dialog element <jarhar> una: having a way to break out behavior vs semantic meaning feels like an easier solution to each than to use <jarhar> masonf: youre calling for abolition of all behavior on the dialog element <jarhar> gregw: i think this is the perfect place to discuss this, super approachable for anyone <jarhar> gregw: by all means also go in on whatwg issues <masonf> q? <jarhar> gregw: to your tactical statement, when we first started it thats what the office team started for - give me attributes to put on my elements, and let the element define semantics <jarhar> gregw: we could make a toast element <jarhar> gregw: huge supporter of both deprecating non-modal and in favor of getting rid of all behaviors on dialog and saying it is a semantic thing only and only leverages popover apis since its 90% the same and it is confusing to unas point <jarhar> gregw: theres 3 or 4 different issues here <gregwhitworth> ack scotto <jarhar> scotto: i am supportive of opening modal dialogs without script <jarhar> scotto: i wonder how to do that in a way that makes sense <jarhar> scotto: put a modal attribute on the dialog. on the surface that could work but theres some displeaussre in html where attributes can mean something in one context but be irrelevant in others <jarhar> scotto: if they put modal on the dialog but then force it open via css, if that modal attribute actually made the rest of the page inert, then through some error of css then the entire page is unusable, particularly to people using AT <gregwhitworth> with regards to declarative opening/closing of dialog I would align with Mason on a dialog specific API definitions, not leveraging popover unless we can get una ambitious option of dialog only being semantic <JonathanNeal> seems like unopened modals need to exist in the opposite of top-layer. bottom-layer, non-layer, hell-scape, whatever. <jarhar> scotto: if we could make that attribute only have functionality if someone opened it via showmodal method or triggering element, then thats totally fine, but we have that other situation that HTML wants to get away from is that checked attribute on input type checkbox where its only usable on page load <jarhar> scotto: after its changed it doesnt mean anything <gregwhitworth> q? <gregwhitworth> ack gregwhitworth <gregwhitworth> ack hdv <jarhar> hdv: i agree with a lot of what was said, i do think its useful to discuss in this venue <jarhar> hdv: i agree that its a danger to become really complicated <jarhar> hdv: ive written a blog post about the difference between dialogs and popovers, and its hard <jarhar> hdv: theres a lot of opportunity to make it easier if we have a way that makes dialogs similar to popover <jarhar> hdv: declarative ways of openining them and things like that <jarhar> hdv: careful that we dont introduce more complication, more ways to get it wrong <jarhar> gregw: do you guys have use counter of dialogs for modal vs non-modal <jarhar> masonf: yes <jarhar> gregw: that would be my curiosity, agree that non-modal can be deprecated <masonf> showmodal: https://chromestatus.com/metrics/feature/timeline/popularity/3726 <masonf> show: https://chromestatus.com/metrics/feature/timeline/popularity/3725 <jarhar> una: my concern with deprecation, we will get questions about what if a i have a dialog experience in a non-modal popover that appears at top of page, that might be semantically a dialog, i dont konw <jarhar> una: if those cases exist it seems like we would get some pushback <jarhar> scotto: there is some discussion on the scope of deprecation, we can discuss another time <jarhar> masonf: showmodal has 30x usage of show, show is just inched above easy to deprecate threshold <jarhar> gregw: that one to me we can totally have an issue and have a stance <gregwhitworth> Zakim, end meeting |
I wasn't at the meeting but it seems like there was discussion around deprecation of non-modal |
That was indeed the proposed direction: deprecate |
It looks like the discussion for this feature request is really happening over on whatwg/html#3567. Should we close this issue, to avoid having it in two places? |
FWIW, |
Closing in favor of whatwg/html#3567 |
When playing with
popover
recently, I ran into a scenario which I think will be relatively common: folks wanting dialog-like behavior (i.e. inerting content on the rest of the page when the dialog is open), with the developer ergonomics thatpopover
andpopovertoggle
provide.In this example, I wouldn't want the rest of the page to be interactive while one of the popovers is open (you can see that I can still hover and click on buttons behind the popover
::backdrop
. Not ideal.In this case, the popovers should probably be dialogs, but making them
<dialog>
, plus invoking them with.showModal()
is the only way to get this behavior. Is there a way to get declarative popover-like developer ergonomics with dialog element semantics and behavior?Some initial thoughts on solutions:
popover=modaldialog
dialogtarget=foo dialogtargetaction=modal
(@mfreed7's suggestion)The text was updated successfully, but these errors were encountered: