-
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
inert: Hit-testing / selection behavior shouldn't be magical. #5650
Comments
It's not clear to me that the |
This ignores the critical point that Missing this point proves exactly the reason why we want to combine all these behaviours together: authors tend to miss this as well, and it creates a poor experience for users, who come first in the priority of constituencies.
This is probably an oversight in the spec. I'm happy to fix that up. |
Well so is
Sure, I was talking about the selection / hit-testing behavior. But in any case, again, I do agree inert is valuable, I just don't think we should add more switches to tweak things we already have switches for. |
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)
Though this means that toggling "inert" on a node needs to restyle the whole subtree, which may be slightly unfortunate and one similar concern? Though you need to do work on the whole subtree with or without the CSS, to make it reasonably efficient, I think. |
I don't follow the logic here. Much of the value of inert is that it combines all these behaviours together, and is straightforward to use and understand: it operates on the DOM subtree, and can't be overridden. What switches are you talking about adding? |
I'm talking about adding another way to control selection / hit-testing / etc behavior that works regardless of CSS (via My proposal above achieves the "can't be overridden" bit in the same way (by using I feel like maybe we're talking past each other a bit? I'd be happy to sync in person real quick if you wanted or what not. |
Because I feel like either I'm not expressing myself correctly, or we're misunderstanding each other's propositions, or I'm missing something, or maybe something else? Again, I'm very much not against this feature, I just feel like the way it's defined and implemented could be simpler :) |
So a few clarifications here:
This redefinition would have the advantages that: a. It simplifies the specification of b. It improves the experience for authors who are trying to examine CSS computed values of these properties to understand what the event / selection / cursor behavior of their elements are. c. It allows content authors who actually do want part of Note that (b) also means that compatibility with then-existing (but not yet existing) content might prevent us from making this redefinition in the future, which is why it's somewhat important to decide one way or another now or at least soon. I'd also note that the required changes to |
Just to clarify, I don't think there's no need to change user-select, if you specify that |
There seem to be several issues conflated here:
What is the user or author need for this functionality? Is there a specific case in which it would be useful? Is there a precedent for this other than
Each of these additions should be addressing a specific user need, like It's also not clear to me that having CSS control behaviour, particularly for things like focus, is actually a good thing. Having something be defined in HTML rather than CSS doesn't make it intrinsically "magic". Plus, as @dbaron pointed out, giving authors more control can actually harm users, if authors actually want
Yes, it is. This is largely because there is no hit testing spec. |
I'll also point out that Maciej Stachowiak left the following feedback on the
|
I think the precedent for this is in some ways a significant part of CSS1 and CSS2, which were motivated by separating out the "presentational" behaviors that existed in HTML into a separate language and thus allowing HTML to deprecate its presentational attributes for use in new documents and recommend that new documents use CSS instead and explain them in terms of their mapping into CSS. |
I think it would be useful for authors. For users there's no difference of course. Regarding other precedents, We're clear we don't want to allow authors to override I'm pretty sure that if we changed
If modifying the behavior of hit testing is required for
CSS already controls focus behavior, via both
Yeah, but that is about making |
Thanks for the examples, and to David for the the explanation of the philosophical precedent.
Fair point.
I strongly disagree. This is equivalent to exposing part of (Also,
I'm obviously not arguing that we should make breaking changes to For
Yes and no. I think our remaining disagreement (other than adding a new
Are there any other remaining disagreements I've missed? |
While I'm sympathetic to that argument, having a hit-testing behavior that you can't achieve via the existing hit-testing switches seems more wrong to me than exposing this particular capability (which is likely to be useful in other ways).
That may be fair, but it's not going anywhere, so I'd rather not introduce yet another out of band way of changing hit-testing behavior.
I'm not sure what you're suggesting, but they'd also need to check the style, on top of
If you want to answer "is this node inert?" that's the same thing with or without this proposed change. However to answer "is this node selectable?" they'd have to both check
I think there is clear author value, but I'm happy to be convinced otherwise. The use case can be as simple of "checking whether node X is selectable?".
There's no need to specify internal pseudo-classes that aren't exposed to web content, just their effects. There's no need to implement it using my pseudo-code in the OP, you could write it with three lines of code in Blink's I think specifying that inert nodes must get a computed
As I said, I don't think it's a massive task. In fact, I think making this change would end up with a simpler specification. I'd personally rather get it done before shipping inert, because it's a web observable, but I mean, it's your engine, you can ship whatever you want. I don't have a super-clear example of how changing this in the future could cause problems, but I don't think that we should make breaking changes if we can avoid them before shipping, and I've seen sufficiently bizarre compat issues before to be wary of any gratuitous breaking change. I'm happy to punt on this if folks from other browser engines don't agree with me or what not.
No, that was a great summary, thank you. |
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)
WebKit is staring to implement First, does Second, I'm unclear on how the blocked by modal dialog algorithm works if |
@chrishtr Can we move forward on this? I'm trying to merge web-platform-tests/wpt#30866 if possible. |
Both Gecko and WebKit implement inertness based on CSS primitives like forcing 'pointer-events: none' at used value time, instead of using a magical hit testing retargeting for inert. And in whatwg/html#5650, the CSSWG resolved that this is the right approach. Then rather than tracking inertness using Node::IsInert, it will just be simpler to use ComputedStyle::IsInert. This patch implements that. There are some differences, like nodes in a 'display: none' subtree won't have a ComputedStyle so we can't really tell if they are inert, but in practice this doesn't matter since they are not rendered. Bug: 692360 TEST=StyleResolverTest.IsInertWithAttributeAndDialog TEST=StyleResolverTest.IsInertWithDialogs TEST=StyleResolverTest.IsInertWithFullscreen TEST=StyleResolverTest.IsInertWithFrameAndFullscreen TEST=StyleResolverTest.IsInertWithBackdrop Change-Id: I4f8c87ea2fbc17f57290edaf185cdff4aebb7e58 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3263937 Reviewed-by: Rune Lillesveen <[email protected]> Commit-Queue: Oriol Brufau <[email protected]> Cr-Commit-Position: refs/heads/main@{#941651}
Based on work in whatwg#4288 by Alice Boxhall. Tests: https://github.com/web-platform-tests/wpt/tree/master/inert. Closes whatwg#5650. Co-authored-by: Alice Boxhall <[email protected]>
Both Gecko and WebKit implement inertness based on CSS primitives like forcing 'pointer-events: none' at used value time, instead of using a magical hit testing retargeting for inert. And in whatwg/html#5650, the CSSWG resolved that this is the right approach. Then rather than tracking inertness using Node::IsInert, it will just be simpler to use ComputedStyle::IsInert. This patch implements that. There are some differences, like nodes in a 'display: none' subtree won't have a ComputedStyle so we can't really tell if they are inert, but in practice this doesn't matter since they are not rendered. Bug: 692360 TEST=StyleResolverTest.IsInertWithAttributeAndDialog TEST=StyleResolverTest.IsInertWithDialogs TEST=StyleResolverTest.IsInertWithFullscreen TEST=StyleResolverTest.IsInertWithFrameAndFullscreen TEST=StyleResolverTest.IsInertWithBackdrop Change-Id: I4f8c87ea2fbc17f57290edaf185cdff4aebb7e58 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3263937 Reviewed-by: Rune Lillesveen <[email protected]> Commit-Queue: Oriol Brufau <[email protected]> Cr-Commit-Position: refs/heads/main@{#941651} NOKEYCHECK=True GitOrigin-RevId: ab14f17b660d05dc15925fea64f3cfd92c6f1ed1
The
inert
attribute as defined in #4288 changes hit testing and selection behavior in ways that can already be controlled via CSS viapointer-events
anduser-select
, respectively. It also forcescursor
to bedefault
, in practice.It seems to me that, rather than adding a second magic way of controlling this behavior, defining this in terms of either existing or new values for those CSS properties makes more sense. Defining inert in a way that
inert
nodes (note: not nodes with theinert
content attribute) must have a computed value ofpointer-events: none
anduser-select: none
is the easiest way to address this.This would be equivalent to the following pseudo-code in a user-agent stylesheet:
Per the discussion in mozilla/standards-positions#174, there's a subtle difference between the behavior of
pointer-events: none
and the intended behavior ofinert
, which is thatpointer-events: none
doesn't prevent boxes behind (but not inside) the inert node from getting hit. If this behavior is both intentional and important, which per that discussion seems to be, then it seems such a behavior should be specifiable viapointer-events
as well.Note that focus behavior used to be controllable via CSS as well, via
user-focus
, but it seems it's been removed from the latest draft. cc @frivoal as editor of that spec in case he remembers why. Generally focusability already depends on CSS (visibility
andoverflow
and such). But special-casing inert for focus ifuser-focus
doesn't exist might be fine, as that's not something that we expose in other ways.Also, it seems a bit odd that
inert
as specified changes the behavior of some selection APIs, likesetSelectionRange
, but notselectionStart
/selectionEnd
setters. Why is that needed / desirable?Generally, I don't think
inert
should be described in terms of event dispatching / selection magic when we have existing features in the platform to control whatinert
wants to control.cc: @annevk @smaug---- @alice @bkardell @robdodson @smfr
The text was updated successfully, but these errors were encountered: