-
Notifications
You must be signed in to change notification settings - Fork 73
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
HTML: inert attribute #174
Comments
Not quite true: they will go to the nearest ancestor which would be found by hit-testing at the point that the event was generated at. http://web-platform-tests.live/inert/inert-retargeting.tentative.html demonstrates this behaviour - try in Chrome canary/dev channel with |
So it is like pointer-events: none; for hit-testing? |
So the explainer says:
Gecko still has to this day a Has such an approach being considered? Over-all it'd seem a bit more consistent with the way e.g., |
Then inert maybe could be just defined with something like:
Also, from what I can see |
Also, |
Not exactly. |
Here's what we have in the explainer on that topic:
|
Is the shadow dom behavior described in #174 (comment) intentional? It seems as a web component author it may be reasonable to try to use |
I need to look into this more, but you're probably right that it should use the flat tree rather than the shadow-including tree. Thanks for catching! |
The proposal looks reasonable to me, but the pr needs to be updated (and some more wpt tests added). |
I was just looking at this now. I think the only update required (other than rebasing) is modifying the language noted in #174 (comment) - however, I'm not sure exactly how to word it. The language in question is:
I agree that this is not quite right, but I don't see any other examples of referring directly to the flat tree. @emilio do you have any suggestions on how to word this?
@smaug---- could you clarify what additional tests you'd like to see beyond the suite in http://web-platform-tests.live/inert/ ? |
There are a few references to https://drafts.csswg.org/css-scoping/#flat-tree and such. Not sure if it's ok to reference that spec from html, or whether that definition should be moved to somewhere else. |
Should probably discuss about the actual spec issue in whatwg, not in this standards-position issue. |
@smaug---- Do you think you could comment on what additional tests you'd like to see? |
@alice there should be more tests covering inert handling in shadow DOM. |
@smaug---- There are two tests currently covering how inert propagates through Shadow DOM/flat tree: I'd love it if you can take a look and tell me whether you see any cases I haven't covered. As far as leaking information goes, I'm not clear on the concern there. Leaving aside that it would be difficult to deduce that an element other than the ancestor with the |
@smaug---- Just bumping the above comment. |
@alice |
So sorry, I couldn't quite follow that. Any chance you could make a quick code example of what you mean?
Good point, will add a test for that. |
Pseudo code And then make either span or slot inert and fire some event on top of 'some text' |
Thanks for the example! |
Would the correct assessment from the comments be that we should consider this |
Worth prototyping sounds good to me. |
Yeah, it sounds fair, but I have one question while I thought a bit more about this @alice: I think the use cases for off-screen content not being tabbable and such are better addressed by visibility: hidden, fwiw, which does behave like you want there (both preventing focusability and hiding it for a11y). I agree that as a web developer that may be a bit obscure perhaps, but I'm not sure that's quite enough of an issue to introduce this feature. It seems like the other use cases in the explainer want kind of the opposite of inert (as in, make one particular part of the page interactive, rather than non-interactive, making the rest automatically "inert"). But I may be misunderstanding some? And I guess that's a bit harder to define, as you need to deal with the attribute being in multiple subtrees, which is easier than with this hypothetical opposite thing. Could you clarify whether the above bits are true and / or I am misunderstanding something (which is definitely possible)? If I'm not missing much, maybe the explainer should elaborate a bit on the reasoning behind the design? Otherwise I can mostly try to guess that it is due to ease of implementation / specification, but regardless of whether it's that or another thing it should probably be spelled out. Thanks so much. |
I think the primary reason we thought However, if you set that element to |
Regarding the use cases for the "opposite of inert" primitive - you're right that it's largely around ease of specification, combined with the fact that there is a use case for This is actually addressed in the explainer (albeit somewhat non-obviously) in the "Wouldn't this be better as" section:
|
I don't think this argument applies. First, not all compositors use layers, fwiw. But also if the menu is off-screen and not animating, browsers usually won't promote them to GPU surfaces anyway to save GPU memory, which is a scarce resource. So the menu will only be promoted to the GPU once you start animating it, and at that point you no longer need
What is the use case for |
Btw, another thing that was unclear to me, while I re-read the thread, just to confirm... You said:
But that is exactly the behavior I see with a simple test-case like this: <!doctype html>
<style>
.none {
pointer-events: none;
width: 100px;
height: 100px;
}
</style>
<div id="ancestor">
<div class="none">
<div id="child">Child</div>
</div>
</div>
<script>
document.addEventListener("click", function(e) {
console.log(e.target);
});
</script> (i.e., clicks on So the only difference that I'm aware of at this point is that with |
Or you mean that with |
The explainer lists the following, in addition to the use case Rob discussed:
My wording was awkward: by "this" I meant the behaviour specced for
To turn the question back around: is there any harm you could imagine from shipping the |
I'll need to test this again. If I recall I tested it years ago and Chrome's behavior was to keep the layer when it was offscreen and to remove it if it had visibility: hidden. But I can double check. |
Note that layers in chrome as I understand it are not necessarily always composited (so, regardless whether there's a "layer", it's I think not necessarily a GPU surface). Not clear to me that the devtools inspector is the best way to argue here. Would probably be better to confirm with a Chromium engineer whether they promote to GPU surfaces stuff that's offscreen and is not animating at the moment. I guess will-change transform could serve as a hint to do that... I'd still be mildly surprised that they'd do that for every element that has will-change: transform even if off-screen, specially on android, where GPU memory can be way more scarce. But anyhow that's not the point, I digress... The definition of
(not that it matters much, fwiw, but isn't
I see, thank you. Is there any reason you chose this behavior in particular? Why is it more useful than the current pointer-events behavior? Also, should this particular behavior really be tied to inert, rather than being another
Well, not particularly other than the risk of shipping something that adds a bunch of complexity / subtleties for both authors and implementors, but which we don't know whether it's going to be the final solution for the problems we're trying to solve. It might be ok if inert was clearly a primitive that we need for those things, but it's not clear to me how to cleanly implement blocking elements, etc on top of inert (because they want fundamentally the opposite). I also think that the design could be a bit cleaner / simpler if the primitives |
The current
They need the same concept of "inertness" (which is shared by the
Can you expand on why? Why do you feel that CSS the right place for this to live? In any case, I would be happy with it also being in CSS, but as I said in the explainer:
In particular, the combination of behaviours is important; it's very likely that authors would apply only a subset of the necessary primitives. |
Sure.
Yeah, though people use it for other things all the time, and it does work for non-SVG.
Sure, but
Because it seems really odd to have things affect hit-testing without authors being able to query it, or override it, etc. It also more generally feels wrong for hit-testing to depend on the DOM, it should ideally just depend on the layout tree + css.
Sure, I agree that the combination is important, but the hit-testing behavior seems potentially useful outside of inert (and so does the selection behavior, which is already exposed via CSS). I don't know why we should have two switches, one based on the DOM and one based on CSS for these, when it's relatively straight-forward to define the attribute's behavior in terms of CSS.
I see, so your worry is the one of authors potentially misusing the primitives if we only expose them via CSS? I'm not sure to what extent I share that concern, but in any case that seems somewhat tangential. To be clear, what I'm suggesting is that the definition of the |
Also general focusability in CSS has been proposed in w3c/csswg-drafts#1748 and w3c/csswg-drafts#3379. Not sure if this adds much value to your discussion but I couldn't help noticing some overlap in older related issues. |
|
I wasn't arguing otherwise.
You can't query or override Also, it not being possible to override it is a deliberate feature: it makes it simple to reason about what happens if you use
Once again: I'm not opposed to working towards this, but without blocking shipping You may not be concerned about authors failing to apply all of the necessary properties, but I am. I see this over and over again with authors doing just enough to handle the use case for sighted users using a pointing device, and creating a broken experience for everyone else. |
Yeah, just to elaborate some more - this was very conscious. display none, visibility hidden, aria hidden, these apply to the subtree, you can't opt out further down... Same needs to be here or it doesn't make a lot of sense. Part of the goal here in our minds was that this is a level up:. Authors already have plenty of low-level knobs that can be turned, but for this kind of problem its a matter of juggling lots of knobs and it's easy to get wrong (or just not do it).
Sure. I'm pro-exploring this too! Authors really ultimately should have access to the knobs we can expose and explanations of magic we can explain. Like @alice though, I don't think it actually needs to block anything here on this point if we've split the problem well. Is there a very particular concern that you have here that leads you to believe otherwise? Authors need a higher tool for this pattern, or we can't expect it to be very common that they get it right.
I'll just add that these are by no means done things, or solved. Focus has a few decades worth of troubling bits we're actively trying to work though - the focus metabug has a good starting list. Concerns about this have been brought up and discussed several times, and even a counter proposal leading to a larger discussion last year in Toronto during CSSWG. So, all I am saying there is - we should take those with a very healthy grain of salt. |
#174 (comment) seems to suggest that the consensus was that this is worth prototyping, but I don't see that on https://mozilla.github.io/standards-positions/. Has the position changed? |
That is fine. You can specify a
That is... not true?
I guess I kinda disagree on what the lowest layer is, but... :) |
No, I think we just need to reflect it on the repo, I'll send a PR for that :) |
(Sorry, I had missed this question...) Well, my main concern is that how this works is totally observable if you implement it one way or another. So I'd rather get it right from the beginning. |
Mark it as worth-prototyping as per this comment[1] and following. Closes #4288, let's continue the more technical discussion somewhere else, like in the specification issue. [1]: mozilla#174 (comment)
Mark it as worth-prototyping as per this comment[1] and following. Closes #4288, let's continue the more technical discussion somewhere else, like in the specification issue. [1]: mozilla#174 (comment)
Ok, I filed whatwg/html#5650 with a (hopefully good) summary of the current discussion. I think we should keep discussing the technical details there. It also has a more concrete proposal of what I've talked about up-thread, so hopefully my opinion is a bit better reflected there as well. Per discussion with Anne, this is something that we generally want to support, but we'd like the design to be fully fleshed out before committing to it. |
Mark it as worth-prototyping as per this comment[1] and following. Closes #4288, let's continue the more technical discussion somewhere else, like in the specification issue. [1]: mozilla#174 (comment)
Mark it as worth-prototyping as per this comment[1] and following. Closes #4288, let's continue the more technical discussion somewhere else, like in whatwg/html#5650. Same as mozilla#369, but with @dbaron's feedback addressed, because apparently I can't re-open a PR if I have already force-pushed to the same branch. [1]: mozilla#174 (comment)
So in #371 @tantek asked whether we should block on the resolution of whatwg/html#5650. While I think @emilio is correct that this probably should have been designed so that it affects computed style of So given that |
Mark it as worth-prototyping as per this comment[1] and following. Closes #4288, let's continue the more technical discussion somewhere else, like in whatwg/html#5650. [1]: #174 (comment)
Request for Mozilla Position on an Emerging Web Specification
Other information
The inert attribute allows for marking a section of a document as not being able to receive UI events. Those will go to the nearest ancestor instead.
The text was updated successfully, but these errors were encountered: