-
Notifications
You must be signed in to change notification settings - Fork 668
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
[css-display] Interaction gotchas when delaying the effect of display: none
#8389
Comments
For reference, #7021 rejected exposing inertness as a CSS property. |
Is there a way to express this with a user-agent style or something?
If this isn't an important use case, then could we just make dialogs and popovers inert while transitioning to display:none without adding a new CSS property for inert? |
Re
However, the discussion in the issue indicated it wouldn't be very hard for the existing browser engines to add a CSS version (and in fact they use cascade / CSS infrastructure under the hood to implement the attribute already).
I'm not sure there is a simple way to express this. If there is, it would be nice to help authors avoid exit animation bugs.
One option could be to make all top layer elements inert during a transition in or out of the top layer (and spec it along with the proposed top-layer property, see #8189). And then add |
This isn't part of the landed spec [1], and will be replaced by a combination of these five CSSWG issues: - w3c/csswg-drafts#4441 - w3c/csswg-drafts#6429 - w3c/csswg-drafts#8174 - w3c/csswg-drafts#8189 - w3c/csswg-drafts#8389 After this CL, you will no longer be able to animate your popover like this: ``` [popover] { opacity: 0; transition: opacity 0.2s; } [popover]:open { opacity: 1; } ``` Instead you'll need to use CSS animations or (eventually) transitions and you'll have to explicitly declare the `display` and `top-layer` properties: ``` transition: opacity 0.2s, display 0.2s, top-layer 0.2s; ``` [1] https://html.spec.whatwg.org/multipage/popover.html Bug: 1307772,1413556 Change-Id: I4877dd69a06f2624bdb463b065b2e2b66cbf1154
How inert currently works corresponds roughly to this, so it's not as simple as @jakearchibald mentions. This is what allows modal dialogs to be interactive while the whole document is inert.
I'm reluctant to make this a CSS property since it limits what functionality we could apply to the inert attribute, since it'd be constrained by the CSS cascade. |
(to be clear none of these UA styles currently exist in WebKit, they're expressed from style adjuster: https://searchfox.org/wubkat/rev/90549aec61bacbaee7383e1fb2623cf34edc9273/Source/WebCore/style/StyleAdjuster.cpp#569-581) |
@flackr you had some thoughts around this, but I can't remember what they were |
This isn't part of the landed spec [1], and will be replaced by a combination of these five CSSWG issues: - w3c/csswg-drafts#4441 - w3c/csswg-drafts#6429 - w3c/csswg-drafts#8174 - w3c/csswg-drafts#8189 - w3c/csswg-drafts#8389 After this CL, you will no longer be able to animate your popover like this: ``` [popover] { opacity: 0; transition: opacity 0.2s; } [popover]:open { opacity: 1; } ``` Instead you'll need to use CSS animations or (eventually) transitions and you'll have to explicitly declare the `display` and `top-layer` properties: ``` transition: opacity 0.2s, display 0.2s, top-layer 0.2s; ``` [1] https://html.spec.whatwg.org/multipage/popover.html Bug: 1307772,1413556 Change-Id: I4877dd69a06f2624bdb463b065b2e2b66cbf1154
If this were to be added, it would be helpful to have a pseudoclass ( |
We can have either an |
This isn't part of the landed spec [1], and will be replaced by a combination of these five CSSWG issues: - w3c/csswg-drafts#4441 - w3c/csswg-drafts#6429 - w3c/csswg-drafts#8174 - w3c/csswg-drafts#8189 - w3c/csswg-drafts#8389 After this CL, you will no longer be able to animate your popover like this: ``` [popover] { opacity: 0; transition: opacity 0.2s; } [popover]:open { opacity: 1; } ``` Instead you'll need to use CSS animations or (eventually) transitions and you'll have to explicitly declare the `display` and `top-layer` properties: ``` transition: opacity 0.2s, display 0.2s, top-layer 0.2s; ``` [1] https://html.spec.whatwg.org/multipage/popover.html Bug: 1307772,1413556 Change-Id: I4877dd69a06f2624bdb463b065b2e2b66cbf1154
This isn't part of the landed spec [1], and will be replaced by a combination of these five CSSWG issues: - w3c/csswg-drafts#4441 - w3c/csswg-drafts#6429 - w3c/csswg-drafts#8174 - w3c/csswg-drafts#8189 - w3c/csswg-drafts#8389 After this CL, you will no longer be able to animate your popover like this: ``` [popover] { opacity: 0; transition: opacity 0.2s; } [popover]:open { opacity: 1; } ``` Instead you'll need to use CSS animations or (eventually) transitions and you'll have to explicitly declare the `display` and `top-layer` properties: ``` transition: opacity 0.2s, display 0.2s, top-layer 0.2s; ``` [1] https://html.spec.whatwg.org/multipage/popover.html Bug: 1307772,1413556 Change-Id: I4877dd69a06f2624bdb463b065b2e2b66cbf1154
I was thinking we could use the base value of the display property. This is the value generated for the property in the absense of animations and is used as the base value when compositing animations in web-animations-1. It would be The main downsides I can think of are:
|
The other option would be to define and use the animation end state, though I'd be concerned that working that out may require a style calc with non-local information. E.g. ancestor animations on variables affecting the local animation. The base style is something we already have and usually is the end state. |
This isn't part of the landed spec [1], and will be replaced by a combination of these five CSSWG issues: - w3c/csswg-drafts#4441 - w3c/csswg-drafts#6429 - w3c/csswg-drafts#8174 - w3c/csswg-drafts#8189 - w3c/csswg-drafts#8389 After this CL, you will no longer be able to animate your popover like this: ``` [popover] { opacity: 0; transition: opacity 0.2s; } [popover]:open { opacity: 1; } ``` Instead you'll need to use CSS animations or (eventually) transitions and you'll have to explicitly declare the `display` and `top-layer` properties: ``` transition: opacity 0.2s, display 0.2s, top-layer 0.2s; ``` [1] https://html.spec.whatwg.org/multipage/popover.html Bug: 1307772,1413556 Change-Id: I4877dd69a06f2624bdb463b065b2e2b66cbf1154
This isn't part of the landed spec [1], and will be replaced by a combination of these five CSSWG issues: - w3c/csswg-drafts#4441 - w3c/csswg-drafts#6429 - w3c/csswg-drafts#8174 - w3c/csswg-drafts#8189 - w3c/csswg-drafts#8389 After this CL, you will no longer be able to animate your popover like this: ``` [popover] { opacity: 0; transition: opacity 0.2s; } [popover]:open { opacity: 1; } ``` Instead you'll need to use CSS animations or (eventually) transitions and you'll have to explicitly declare the `display` and `top-layer` properties: ``` transition: opacity 0.2s, display 0.2s, top-layer 0.2s; ``` [1] https://html.spec.whatwg.org/multipage/popover.html Bug: 1307772,1413556 Change-Id: I4877dd69a06f2624bdb463b065b2e2b66cbf1154
This isn't part of the landed spec [1], and will be replaced by a combination of these five CSSWG issues: - w3c/csswg-drafts#4441 - w3c/csswg-drafts#6429 - w3c/csswg-drafts#8174 - w3c/csswg-drafts#8189 - w3c/csswg-drafts#8389 After this CL, you will no longer be able to animate your popover like this: ``` [popover] { opacity: 0; transition: opacity 0.2s; } [popover]:open { opacity: 1; } ``` Instead you'll need to use CSS animations or (eventually) transitions and you'll have to explicitly declare the `display` and `top-layer` properties: ``` transition: opacity 0.2s, display 0.2s, top-layer 0.2s; ``` [1] https://html.spec.whatwg.org/multipage/popover.html Bug: 1307772,1413556 Change-Id: I4877dd69a06f2624bdb463b065b2e2b66cbf1154 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4225730 Reviewed-by: David Baron <[email protected]> Commit-Queue: David Baron <[email protected]> Commit-Queue: Mason Freed <[email protected]> Auto-Submit: Mason Freed <[email protected]> Cr-Commit-Position: refs/heads/main@{#1107048}
This isn't part of the landed spec [1], and will be replaced by a combination of these five CSSWG issues: - w3c/csswg-drafts#4441 - w3c/csswg-drafts#6429 - w3c/csswg-drafts#8174 - w3c/csswg-drafts#8189 - w3c/csswg-drafts#8389 After this CL, you will no longer be able to animate your popover like this: ``` [popover] { opacity: 0; transition: opacity 0.2s; } [popover]:open { opacity: 1; } ``` Instead you'll need to use CSS animations or (eventually) transitions and you'll have to explicitly declare the `display` and `top-layer` properties: ``` transition: opacity 0.2s, display 0.2s, top-layer 0.2s; ``` [1] https://html.spec.whatwg.org/multipage/popover.html Bug: 1307772,1413556 Change-Id: I4877dd69a06f2624bdb463b065b2e2b66cbf1154 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4225730 Reviewed-by: David Baron <[email protected]> Commit-Queue: David Baron <[email protected]> Commit-Queue: Mason Freed <[email protected]> Auto-Submit: Mason Freed <[email protected]> Cr-Commit-Position: refs/heads/main@{#1107048}
This isn't part of the landed spec [1], and will be replaced by a combination of these five CSSWG issues: - w3c/csswg-drafts#4441 - w3c/csswg-drafts#6429 - w3c/csswg-drafts#8174 - w3c/csswg-drafts#8189 - w3c/csswg-drafts#8389 After this CL, you will no longer be able to animate your popover like this: ``` [popover] { opacity: 0; transition: opacity 0.2s; } [popover]:open { opacity: 1; } ``` Instead you'll need to use CSS animations or (eventually) transitions and you'll have to explicitly declare the `display` and `top-layer` properties: ``` transition: opacity 0.2s, display 0.2s, top-layer 0.2s; ``` [1] https://html.spec.whatwg.org/multipage/popover.html Bug: 1307772,1413556 Change-Id: I4877dd69a06f2624bdb463b065b2e2b66cbf1154 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4225730 Reviewed-by: David Baron <[email protected]> Commit-Queue: David Baron <[email protected]> Commit-Queue: Mason Freed <[email protected]> Auto-Submit: Mason Freed <[email protected]> Cr-Commit-Position: refs/heads/main@{#1107048}
…over animation stuff, a=testonly Automatic update from web-platform-tests Rip out all of the beautiful bespoke Popover animation stuff This isn't part of the landed spec [1], and will be replaced by a combination of these five CSSWG issues: - w3c/csswg-drafts#4441 - w3c/csswg-drafts#6429 - w3c/csswg-drafts#8174 - w3c/csswg-drafts#8189 - w3c/csswg-drafts#8389 After this CL, you will no longer be able to animate your popover like this: ``` [popover] { opacity: 0; transition: opacity 0.2s; } [popover]:open { opacity: 1; } ``` Instead you'll need to use CSS animations or (eventually) transitions and you'll have to explicitly declare the `display` and `top-layer` properties: ``` transition: opacity 0.2s, display 0.2s, top-layer 0.2s; ``` [1] https://html.spec.whatwg.org/multipage/popover.html Bug: 1307772,1413556 Change-Id: I4877dd69a06f2624bdb463b065b2e2b66cbf1154 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4225730 Reviewed-by: David Baron <[email protected]> Commit-Queue: David Baron <[email protected]> Commit-Queue: Mason Freed <[email protected]> Auto-Submit: Mason Freed <[email protected]> Cr-Commit-Position: refs/heads/main@{#1107048} -- wpt-commits: 635df2dae0185211850d336ed6320ec35e4f4f3f wpt-pr: 38392
…over animation stuff, a=testonly Automatic update from web-platform-tests Rip out all of the beautiful bespoke Popover animation stuff This isn't part of the landed spec [1], and will be replaced by a combination of these five CSSWG issues: - w3c/csswg-drafts#4441 - w3c/csswg-drafts#6429 - w3c/csswg-drafts#8174 - w3c/csswg-drafts#8189 - w3c/csswg-drafts#8389 After this CL, you will no longer be able to animate your popover like this: ``` [popover] { opacity: 0; transition: opacity 0.2s; } [popover]:open { opacity: 1; } ``` Instead you'll need to use CSS animations or (eventually) transitions and you'll have to explicitly declare the `display` and `top-layer` properties: ``` transition: opacity 0.2s, display 0.2s, top-layer 0.2s; ``` [1] https://html.spec.whatwg.org/multipage/popover.html Bug: 1307772,1413556 Change-Id: I4877dd69a06f2624bdb463b065b2e2b66cbf1154 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4225730 Reviewed-by: David Baron <[email protected]> Commit-Queue: David Baron <[email protected]> Commit-Queue: Mason Freed <[email protected]> Auto-Submit: Mason Freed <[email protected]> Cr-Commit-Position: refs/heads/main@{#1107048} -- wpt-commits: 635df2dae0185211850d336ed6320ec35e4f4f3f wpt-pr: 38392
…over animation stuff, a=testonly Automatic update from web-platform-tests Rip out all of the beautiful bespoke Popover animation stuff This isn't part of the landed spec [1], and will be replaced by a combination of these five CSSWG issues: - w3c/csswg-drafts#4441 - w3c/csswg-drafts#6429 - w3c/csswg-drafts#8174 - w3c/csswg-drafts#8189 - w3c/csswg-drafts#8389 After this CL, you will no longer be able to animate your popover like this: ``` [popover] { opacity: 0; transition: opacity 0.2s; } [popover]:open { opacity: 1; } ``` Instead you'll need to use CSS animations or (eventually) transitions and you'll have to explicitly declare the `display` and `top-layer` properties: ``` transition: opacity 0.2s, display 0.2s, top-layer 0.2s; ``` [1] https://html.spec.whatwg.org/multipage/popover.html Bug: 1307772,1413556 Change-Id: I4877dd69a06f2624bdb463b065b2e2b66cbf1154 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4225730 Reviewed-by: David Baron <[email protected]> Commit-Queue: David Baron <[email protected]> Commit-Queue: Mason Freed <[email protected]> Auto-Submit: Mason Freed <[email protected]> Cr-Commit-Position: refs/heads/main@{#1107048} -- wpt-commits: 635df2dae0185211850d336ed6320ec35e4f4f3f wpt-pr: 38392
Proposed initial resolution: apply the behavior @flackr suggests above regarding the base value. If there is enough developer demand in the future, consider adding |
The CSS Working Group just discussed
The full IRC log of that discussion<fantasai> flackr: Using display to animate from block to none<fantasai> flackr: this has effect that during animation, the element can still be interacted with and is in the a11y tree <fantasai> flackr: it has problems with e.g. form submission, coudl accidentally submit twice because animating out <fantasai> flackr: proposed resolution is that we look at the base value of the display property, i.e. the value before animation is apply <fantasai> flackr: when animating to none, base value woudl be none <fantasai> flackr: use that to determine whether the element should be in the a11y tree <fantasai> flackr: and also effectively make it inert while it's none <fantasai> flackr: longer-term, we might want to have inert be a CSS property, and this would be part of auto behavior for inert <PaulG> +1 (from APA_ <TabAtkins> +1 frome me <fantasai> flackr: but this would be for doing the right thing in the simple cases <masonf> +1 <fantasai> +1 to "make it work like expected without author fussing" <bramus> +1 <emilio> +1 as long as there are tests for this <fantasai> flackr: [re-explains proposal] <fantasai> Rossen: There was some work that was already happening around inert, curious if your proposal has any tracking with that work <emilio> q+ <fantasai> Rossen: I'm sure inert as CSS property was considered and debated at some point in the past, I'm not sure where we ended up, but would be good to have a tracking issue or at least track that discussion <chrishtr> Link to prior discussion: https://github.com//issues/8389#issuecomment-1419970151 <fantasai> chrishtr: Link to pros and cons <fantasai> chrishtr: my understanding from previous discussion was that no one had strong opinions, and the door was open to adding it in the future <fantasai> Rossen: that answers my question <fantasai> chrishtr: We can do this thing for now, so by default it does the right thing <fantasai> chrishtr: and if there's significant developer need, we can add 'inert' in the future without too much trouble <astearns> ack emilio <fantasai> flackr: yes, this is designed to be forwards-compatible with that <fantasai> emilio: I was thinking about this, inert has this feature where some elements that escape inert-ness <fantasai> emilio: e.g. modal dialog that's now 'display: none', that will not be inert <fantasai> emilio: but 'display: none' would prevent modal dialog from showing <flackr> qq+ <fantasai> emilio: this looks almost like inert, but with that thing where we may not want subtrees to escape inertness? <fantasai> chrishtr: if you have [scenario] <astearns> ack flackr <Zakim> flackr, you wanted to react to emilio <fantasai> flackr: the auto behavior is based on the computed base style of 'display', which even for the descendant would be 'none' <fantasai> emilio: not really, display is not inherited <fantasai> flackr: but it's within an element with a computed base display style of 'none' <TabAtkins> display may not be inherited, but display-none-ness *basically* is <masonf> modal dialog inside a display:none subtree is already display:none. <fantasai> emilio: the way inert is implemented, at least in WebKit and Gecko, basically it's an internal inherited bit in the computed style representation <fantasai> emilio: there are things that can flip that for a subtree <fantasai> emilio: when you have fullscreen element, everything is inert except fullscreen element subtree <oriol> Blink also uses that approach <fantasai> emilio: this inert, we don't want it to be overridden by anything inside the subtree <fantasai> flackr: even if overridden, this proposal would fix the common cases <fantasai> flackr: but if we did allow overriding, you would have these edge cases where the things animating to 'display: none' would not include modal dialog <fantasai> emilio: this proposal helps a lot for ?? cases <fantasai> emilio: just an edge case that might be better to explicitly point out? <fantasai> emilio: "inert, but actually force inertness for the entire subtree" <fantasai> flackr: sounds like something we could consider if we add a CSS property for inertness <fantasai> flackr: I think there are use cases for opting subtree <fantasai> emilio: if we add inert, it would be similar to visibility, can set it differently inside a subtree <fantasai> emilio: might have use cases for inert unable to flip within the subtree <fantasai> emilio: probably the spec should call out this edge case, and define the behavior explicitly <astearns> ack fantasai <fantasai> emilio: if you have fullscreen element inside, define that behavior <emilio> fantasai: for visibility: hidden you can flip back to visible, but visibility: collapse into a flex item doesn't allow you to do that <fantasai> astearns: ready to resolve? <emilio> ... so visibility has that behavior as well <fantasai> s/.../fantasai:/ <fantasai> flackr: inertness is determined by the base computed style for 'display', resulting in animations to 'none' being considered inert <fantasai> astearns: can make that claim generally, not just during animations? <fantasai> flackr: base computed style is all styles before animations <fantasai> astearns: any other comments or concerns? <fantasai> RESOLVED: inertness is determined by the base computed style for 'display', resulting in animations to 'none' being considered inert <fantasai> astearns: +1 to having tests for this |
w3c/csswg-drafts#8389 Bug: 1422736 Change-Id: Ica770040e6932b00fdd0c3a2051c9aee745e4b2b
I have started implementing this in chromium, here is a WPT: web-platform-tests/wpt#39023 |
w3c/csswg-drafts#8389 Bug: 1422736 Change-Id: Ica770040e6932b00fdd0c3a2051c9aee745e4b2b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4342420 Commit-Queue: Joey Arhar <[email protected]> Reviewed-by: Robert Flack <[email protected]> Cr-Commit-Position: refs/heads/main@{#1118269}
w3c/csswg-drafts#8389 Bug: 1422736 Change-Id: Ica770040e6932b00fdd0c3a2051c9aee745e4b2b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4342420 Commit-Queue: Joey Arhar <[email protected]> Reviewed-by: Robert Flack <[email protected]> Cr-Commit-Position: refs/heads/main@{#1118269}
w3c/csswg-drafts#8389 Bug: 1422736 Change-Id: Ica770040e6932b00fdd0c3a2051c9aee745e4b2b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4342420 Commit-Queue: Joey Arhar <[email protected]> Reviewed-by: Robert Flack <[email protected]> Cr-Commit-Position: refs/heads/main@{#1118269}
w3c/csswg-drafts#8389 Bug: 1422736 Change-Id: Ica770040e6932b00fdd0c3a2051c9aee745e4b2b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4342420 Commit-Queue: Joey Arhar <[email protected]> Reviewed-by: Robert Flack <[email protected]> Cr-Commit-Position: refs/heads/main@{#1118269}
This isn't part of the landed spec [1], and will be replaced by a combination of these five CSSWG issues: - w3c/csswg-drafts#4441 - w3c/csswg-drafts#6429 - w3c/csswg-drafts#8174 - w3c/csswg-drafts#8189 - w3c/csswg-drafts#8389 After this CL, you will no longer be able to animate your popover like this: ``` [popover] { opacity: 0; transition: opacity 0.2s; } [popover]:open { opacity: 1; } ``` Instead you'll need to use CSS animations or (eventually) transitions and you'll have to explicitly declare the `display` and `top-layer` properties: ``` transition: opacity 0.2s, display 0.2s, top-layer 0.2s; ``` [1] https://html.spec.whatwg.org/multipage/popover.html Bug: 1307772,1413556 Change-Id: I4877dd69a06f2624bdb463b065b2e2b66cbf1154 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4225730 Reviewed-by: David Baron <[email protected]> Commit-Queue: David Baron <[email protected]> Commit-Queue: Mason Freed <[email protected]> Auto-Submit: Mason Freed <[email protected]> Cr-Commit-Position: refs/heads/main@{#1107048}
w3c/csswg-drafts#8389 Bug: 1422736 Change-Id: Ica770040e6932b00fdd0c3a2051c9aee745e4b2b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4342420 Commit-Queue: Joey Arhar <[email protected]> Reviewed-by: Robert Flack <[email protected]> Cr-Commit-Position: refs/heads/main@{#1118269}
w3c/csswg-drafts#8389 Bug: 1422736 Change-Id: Ica770040e6932b00fdd0c3a2051c9aee745e4b2b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4342420 Commit-Queue: Joey Arhar <[email protected]> Reviewed-by: Robert Flack <[email protected]> Cr-Commit-Position: refs/heads/main@{#1118269}
…ly inert, a=testonly Automatic update from web-platform-tests Make animations to display:none also apply inert w3c/csswg-drafts#8389 Bug: 1422736 Change-Id: Ica770040e6932b00fdd0c3a2051c9aee745e4b2b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4342420 Commit-Queue: Joey Arhar <[email protected]> Reviewed-by: Robert Flack <[email protected]> Cr-Commit-Position: refs/heads/main@{#1118269} -- wpt-commits: 286d2ea3aa0cd9630d5402474c989cfa29c7bc7b wpt-pr: 39023
w3c/csswg-drafts#8389 Bug: 1422736 Change-Id: Ica770040e6932b00fdd0c3a2051c9aee745e4b2b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4342420 Commit-Queue: Joey Arhar <[email protected]> Reviewed-by: Robert Flack <[email protected]> Cr-Commit-Position: refs/heads/main@{#1118269}
I want to bring an issue I encountered while playing with the The issue is: the inert behavior makes it impossible to implement an affordance period for tooltips on hover. Here is a CodePen that demonstrated the issue following issue — https://codepen.io/kizu/pen/rNQBvKm?editors=1100 Note: it seems that there could've been some change in Chrome Canary that broke the A.screen.recording.of.the.CodePen.in.action_.we.re.able.to.hover.out.of.the.element.with.a.transition.in.progress.when.it.is.an.element.with.visibility.transition.but.are.not.able.to.do.so.for.an.element.with.a.display.transition.mp4The way developers usually apply the additional affordance for tooltips on hover is by adding an additional delay before the actual animation duration, allowing the following things:
These are in line with the https://www.w3.org/WAI/WCAG21/Understanding/content-on-hover-or-focus.html, both for the “Hoverable” and “Persistent” success criteria. The problem right now is that the inert (and Proposed solutions:
|
inert forces the browser to act as if we have Adding some thoughts to the different proposals:
Currently the way that we make the node inert is by determining that the base style (i.e. style without animations) is
I'm not sure I understand what you mean by "allow pointer-events"? Do you mean that the node would be inert but still hittable? I think this may be similar to my preferred behavior for inert #6685 (comment) but we would need to flesh out the details about how we still ensure that the elements within will not be interacted with.
I think there's two options here:
|
Yes! I think, similar to the way I think both options can be good, but I'm afraid that exposing inertness is a much risky change overall, and those two could both exist at the same time; meaning if we allow transitioning inertness first, then if we'd later add an ability to control it more freely, it would be just an extension of the existing functionality. |
I do want to remind why I think exposing inertness to CSS is a bad idea:
|
I'd be open to tweaking the pointer events model, but it's work that is unlikely going to get done in implementations given the low gain from it |
TL;DR: This is a follow-on from #6429 (comment), which proposes making
display
animatable, to aid in creating "transition-out" animations.This issue proposes:
inert
property to CSS, and explaining the inert HTML attribute on top of that.display: none
inert for the duration of the animation.Let's say the JavaScript developer on a project creates a dialog/form, and when the form is submitted, the form is hidden via
display: none
, and the result of the form is used somehow in the app.Then, at some later point, the CSS developer adds a transition which extends the interactive life of the element beyond what the JavaScript developer expected (the JavaScript developer and CSS developer may be the same person, but their mindset may be different when working with styles vs script).
This can be done already today, by overriding the default
display: none
on<dialog>
elements (https://jsbin.com/xumitir/edit?html,css,js,output), but animatingdisplay: none
, as proposed in #6429 (comment), creates an even more attractive, less-hacky way to do this.By doing this, the CSS developer has created a significant change to the behaviour of the app. The user can now provide more than one submission to the form, since its lifetime in the app has been extended. This user action might be intentional (clicking the 'wrong' thing, then quickly clicking the right thing) or unintentional (double clicking).
Additionally, the element exists for longer in the accessibility tree, even though the intention is that it's 'gone'. This would result in unexpected behaviour for screen reader users.
These issues wasn't a possibility when the JavaScript developer created the form, so it's possible that these new interactions will be badly handled. The solution is to cater for interactions with the form beyond its previous lifecycle, or to prevent further interactions and AT visibility of the form using
inert
.I think this is worth thinking about for two reasons:
pointer-events: none
is an incomplete fix).Potential solutions:
Education
We tell developers about this problem, and how to solve it in JavaScript. However, I have low confidence that we'd reach everyone, and even when it comes to folks we'd reach, would they remember to avoid these bugs?
Allow
inert
to be set in CSSThe current HTML
inert
attribute could be explained by a UA style:I know there was opposition to this in the past, since it relates to behaviour rather than style, but it feels like
display: none
and particularly transitions ondisplay: none
already have a significant impact on behaviour. Showing an element changes the behaviour of the page, and if that's done in CSS, it seems reasonable to be able to express modality via CSS.Open question: Should it be possible for a child of an inert element to become un-inert? This is possible with
pointer-events
.This means that the interactivity issue created by CSS can be solved with CSS. But, it requires the developer to remember to set it, so:
Make elements transitioning to
display:none
inert by defaultDuring the transition above,
inert
could behave asyes
. This would avoid the situation described at the start of this post, where the CSS developer introduced a behaviour the JS developer hadn't catered for.If the developer wants the element to be interactive during the transition, they can override this default:
The text was updated successfully, but these errors were encountered: