-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Questions/issues with popover spec #9036
Comments
https://html.spec.whatwg.org/multipage/popover.html#light-dismiss-open-popovers
This algorithm expects a
Does this mean a popover will close if you click it? I couldn't immediately see where that's prevented in the spec. |
Thanks for the feedback! A few replies:
This is intended to mean "in the same order as the top layer set". (Top layer is an ordered set.)
No strong opinions from me here. The idea was that it might be more helpful to have this be an error state: you're calling a method that will have no effect. One potential point of confusion is that in order to move an existing top layer item to the top of the top layer, you have to remove it and re-add it. So there could be confusion that developers think they should be able to just call However, I also see your argument that many other APIs on the platform are idempotent and don't throw in similar situations. @annevk @josepharhar any issues removing these two exceptions? If we do change this, it seems like it'd also make sense to change
No, it'll stay open. If you look at the linked Light dismiss open popovers algorithm, step 7.5 will hide all popovers until the clicked popover. Which will leave it open. |
I'll defer to @nt1m (unless he feels the same way, in which case I'll take a look 😊). |
I don't have a strong opinion, my preference goes towards consistency here :) |
Consistency with what? |
I don't really mind as long as the end result is consistent, either by removing exceptions for both dialog and popovers, either keeping them for both. Reduces mental overhead for web developers when things are consistent. |
One thing to think about if we remove the exceptions is whether we want to re-run all the steps, especially for show:
|
This is good to emphasize. I'm supportive of not throwing exceptions for these cases, e.g. double- |
The remaining issues: https://html.spec.whatwg.org/multipage/popover.html#auto-popover-list
"in the same order" seems confusing here. Does it mean document order? Is this list intended to be live? I'd rather turn this into an algorithm that returns a static list, and makes the ordering clear. Is "in the Document's top layer" problematic here? If an element is a descendant of an element in the top layer, is it considered "in the top layer"? I'm worried that "in the top layer" is being used to mean "the popover is shown" here, but that might not be clear/true.
Nit: This algorithm references arguments that aren't specified up front. I'd like to fix this.
This seems a bit of a hand-wave, and 'states' doesn't seem to link to the right thing. I'd like to fix this. https://html.spec.whatwg.org/multipage/popover.html#light-dismiss-open-popovers
This algorithm expects a |
We changed auto popover list to be in terms of the top layer because the alternative had bugs: 1257236. I could see someone trying to remove it entirely, but I don't think we want to go back to maintaining it in parallel with the top layer. |
I believe all of the comments just above are mostly spec nits and not behavior changes.
The spec might be a bit vague here, and I think that's the gist of your comment. But to be clear, in all browsers, only the element itself is "in the top layer". Descendants of that element aren't considered to be in the top layer. It wouldn't make any sense if they were - the top layer is an ordered set, painted in the order of the set. You'd never be able to put any useful content in the top layer, because the descendent content would be strung out into the top layer set and painted sequentially as individual fixed-position elements. |
Yeah, I think it's just the wording that's confusing. Changing it to an algorithm should clear it up.
I think so, although that might depend on what the desired behaviour is.
Cool. It's just unclear language then. Given the DOM is a tree, saying one thing is 'in' another can easily mean it's a descendant. But, if you're wanting to be clear about treating the top layer as an ordered set, you can correctly reference terms to avoid any confusion. I think it's worth clearing this up, because although top layer is an ordered set, it's also a stacking context.
That isn't what I was referring to. Think about it: if I asked you "is this element in the body?", do you think I'm asking if it's a direct child, or a descendant? It's ambiguous, but I think most people would assume descendant. I guess you could say that, when it comes to the top layer, the thinking model switches, but I don't think it's clear. Are we thinking of top layer as a set, or a stacking context? The good news is, as spec writers, we don't have to choose ambiguity. If instead of something like:
it could say:
Which clears up the ordering an 'in' ambiguity. Although, now I write this out, both lines would include an element like |
Agreed - this could be more clear. And as @annevk has pointed out, there's definitely a need to clean up the top layer spec situation. And @atanasov mentioned that this might get discussed tomorrow at CSSWG.
Again, agreed, the language could be more clear. The fullscreen spec says the top layer is a "new stacking layer", not a "new stacking context" but perhaps the intention was the same. Technically, the top layer isn't a stacking context itself, since Either way, I'm totally supportive of clarifying the language here. I just want to ensure we keep the existing, interoperable behavior.
That's definitely a bug in the spec, good catch. That was introduced by 1257236. The intention (and implementation in Chromium) does not include a
|
I guess by "interoperable" here you mean the Chromium implementation, or is there another?
LGTM! |
Both |
Auto popover list is a filter on top of another list. It doesn't make sense to remove things from it. They get removed from the other list (or no longer match the condition). |
@annevk we're talking about the same thing. Another way to describe a filtered list is a clone with items removed. Infra doesn't have the concept of "filter", but we can add it. |
Is it? What if items get added? If the current wording doesn't work I think we should figure out how to remove the entire concept. Reverting that commit makes things worse. |
I'm not talking about reverting that commit, unless I'm misunderstanding something. From the algorithms, it doesn't seem like the list needs to be "live", a snapshot during an algorithm is enough, and writing up how that snapshot is taken seems less ambiguous. |
Looking at the callers I think you're right. We should just turn it into a getter then that does the filtering and we just call it at each call site. |
What are the items that remain that would close this issue?
|
Also this, which passes an element to an algorithm that expects a document. |
@josepharhar do you feel comfortable tackling these two items? |
Fixes whatwg#9036 This patch also fixes a call to topmost auto popover which was passing an element instead of a document.
I created a PR: #9241 |
The attribute change steps to support the popover attribute did not list any arguments, which was pointed out in whatwg#9036 I followed some advice for adding arguments here: whatwg#9093 (comment) This is an editorial change and has no behavioral changes.
I opened another PR to fix this here: #9246 |
The attribute change steps to support the popover attribute did not list any arguments, which was pointed out in #9036. I followed some advice for adding arguments here: #9093 (comment).
I'm reading the popover spec for the first time. Here are some notes & questions. If any of these turn out to be things that should be changed, I'll split each out into their own issue.
https://html.spec.whatwg.org/multipage/popover.html#auto-popover-list
"in the same order" seems confusing here. Does it mean document order? Is this list intended to be live? I'd rather turn this into an algorithm that returns a static list, and makes the ordering clear.
Is "in the Document's top layer" problematic here? If an element is a descendant of an element in the top layer, is it considered "in the top layer"? I'm worried that "in the top layer" is being used to mean "the popover is shown" here, but that might not be clear/true.
https://html.spec.whatwg.org/multipage/popover.html#the-popover-attribute:concept-element-attributes-change-ext
Nit: This algorithm references arguments that aren't specified up front. I'd like to fix this.
This seems a bit of a hand-wave, and 'states' doesn't seem to link to the right thing. I'd like to fix this.
https://html.spec.whatwg.org/multipage/popover.html#check-popover-validity
It seems weird to me that
showPopover()
andhidePopover()
throw if the element is already in that state. I think we usually avoid throwing in these cases.<dialog>
throws ifshowModal()
is called when it's already in that state, but that seems to be an outlier.<dialog>
'sclose()
doesn't throw if the state is already closed.The text was updated successfully, but these errors were encountered: