-
Notifications
You must be signed in to change notification settings - Fork 715
[css-ui] Support setting offscreen content inert #10711
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
Comments
In my opinion, I don't think that this should be in HTML (option 3). Setting it via HTML requires setting it on every element even though it is a property of the way the elements are presented. Also, CSS can switch the way that content is presented based on media queries which would change whether content out of view should be considered inert or not. Between the two CSS options, I think that option 2 is simpler for this use case but feel that option 1 may generalize better to other use cases. |
I agree that option 2 is the most author-friendly. I think it's compatible with also doing 1 in the future if we find that reasonable. We could either make option 2 use the same property we expect to use for option 1, but with a specialized keyword, or do a separate property and define the interaction (probably: it's inert if either property calls it inert). I lean slightly towards the separate property, just because it groups the functionality slightly better with the associated functionality of overflow, and reads slightly better imo. (I can't come up with a good keyword that would real well in a general |
+1 on what Tab said there. Option 2 is a no-brainer for authors, while option 1 can be handy for authors who want fine control over things. For example: adjusting the insets could be considered something exclusively for option 1. Although, that could also make the case for a |
The CSS Working Group just discussed The full IRC log of that discussion<matthieud> flackr: many website designs when creating paginated stuff or when the site provide an alternative to a long scrolling document, the recommended practice is that content outside of the viewport is inert<matthieud> flackr: you dont have the content in your accessibility tree <matthieud> flackr: it can be done with display:none but not very good <matthieud> flackr: you can do aria:hidden as html attribute so need a script as you progress animation <matthieud> flackr: new simple way to say "content out of view is inert" <matthieud> flackr: we could either assign this on the scroller (overflow) or on the element itself ? <emilio> q+ <matthieud> astearns: the default value for overflow-interactivity is auto in option 2 <astearns> ack emilio <astearns> zakim, open queue <Zakim> ok, astearns, the speaker queue is open <kizu> q+ <matthieud> emilio: Is overflow the only place we want to support this use-case ? <matthieud> emilio: author might want this for stuff in the screen <PaulG> q+ <matthieud> flackr: similar usecases to animate to/from content not the accessibility. Option 1 would allow that because its not tight to overflow <ntim> q+ <matthieud> Option 1 has added complexity but you cant select offscreen content with a simple selector today, so for the scrolling usecase you would have to animate the interactivity property with a view timeline or something <astearns> ack kizu <matthieud> kizu: Option 2 is nice. option 1 is powerful but limited <emilio> q+ <matthieud> kizu: always risk to break accessiblity with all options : if we apply this to an element but cant reach it without scrolling, accessiblity will be broken <matthieud> kizu: because it's inert you would only be able to scroll to it, cant reach it in any other way <matthieud> kizu: Option 2 is safer because tight to scrollable container <astearns> s/tight/tied/ <astearns> ack PaulG <matthieud> PaulG: Like kizu, in a listbox with item overflowed. Does the engine will give the correct number of items to the accesssiblity tree when some of them are inert ? <matthieud> flackr: nice question. maybe inert is not the property we want to use then <matthieud> PaulG: maybe inert is fine but not for this scenario. We need to clarify the exact use cases <matthieud> flackr: we dont want to use this when user want to interact with this content <TabAtkins> I'm feeling like this is indeed a "well don't do that" situation <matthieud> flackr: it doesnt make sense to use this for overflowing tabs in a tab list for example <matthieud> flackr: so maybe inert is not what we want <astearns> ack ntim <matthieud> ntim: controlling inert from CSS was originally objected against <matthieud> ntim: inert is not only about presentation but also about content <matthieud> ntim: because it applies aria-hidden <emilio> q <matthieud> flackr: display already does stuff on aria tree even if it is a css property <astearns> ack emilio <matthieud> emilio: for firefox tab bar, we want tab hidden but still remain in the accessibility tree. So we dont really want inert <matthieud> does this only apply to scroller ? or also to overflow-path or clip ? <emilio> s/overflow-path/clip-path/ <matthieud> kizu: for clip it should not work <matthieud> kizu: for hidden not sure <matthieud> flackr: for hidden many time people make it scrollable with other mechanism <matthieud> emilio: we are not sure if we want actual inertness here <matthieud> flackr: we can take it back to the issue <matthieud> astearns: please comment on the issue |
@nt1m This is the previous resolution I am aware of where we decided to not have an inert property yet #7021 (comment). Let me know if there's another discussion we should also link into this issue. From the final lines of the discussion that the main reason we didn't pursue it then was because we didn't have the specific strong use cases for which it was very useful / important:
|
That was not the only discussion, there's a bunch of discussion on other PRs. I'm thinking of the multiple HTML PRs where inert tried to be added:
etc. etc. inert has a long history, so it would be good to check with web a11y experts before moving forward. |
@nt1m Thanks for the context! I'm not sure I understand the root of your concern here. The linked issues are about spec'ing the HTML attribute. Are you saying that because we are moving towards defining inert in HTML it can't also be controlled by CSS? IMO having inertness in CSS does not preclude also having an attribute. E.g. the attribute can be explained by having a UA stylesheet rule: [inert] {
interactivity: inert;
} Then the computed inert value is usually based on the attribute but can be overridden. Alternately it could be a
This is the only issue which makes mention of the possibility of it being controlled by CSS as far as I can see. In particular @othermaciej presented an argument against it being in CSS in WICG/inert#69 (comment) which I'll respond to here given the proposal here is not intended to replace the
As a counter-point, .carousel-item {
display: none; /* "Styles" items inert by default */
}
item.active {
display: block; /* The active item is interactive */
}
This is not incompatible with a CSS inertness property. We have examples of both properties which can escape (e.g.
Happy to loop in a11y experts to the discussion. The intention is to make it easier for authors to meet the guidelines set out as best practices by the ARIA Authoring Practices Guide. Given that these guidelines already make use of |
From #10711 (comment)
@AutoSponge I have since tested this and found that all of |
From #10711 (comment)
@emilio I think that fundamentally there are two shapes this property could take represented by options 1 and 2. In the first case the author explicitly styles which things are inert, and in the latter they apply a style that tries to automate when things need to change states for them. As @tabatkins mentioned they're not necessarily mutually exclusive, but option 2 is trying to handle the common easily detectable cases. If you have any thoughts for things we might be able to do to cover the other use cases you mentioned in an automated way i'd welcome improvements to how option 2 works, but the general question of whether something is visible seems non-trivial to compute. If it's not automatically detectable then it would require a solution like option 1 where the author styles the content inert regardless of its location. If we don't also have an automated option then this adds an additional burden on developers creating scrolling experiences to ensure that they have some way of updating this as the user scrolls changing the current content. |
From an accessibility perspective, my concerns with this are exactly the same as they were for the inert HTML attribute. They are perhaps stronger concerns here because CSS has (at least historically) been primarily associated with presentation, not semantics, so the chances of someone doing this without considering semantics are higher. The risk here is that someone will use this for some unintended semantic purpose where the content is actually semantically relevant but ends up being hidden from a11y APIs. This is particularly problematic for the CSS inertness property (proposed option 1), probably a bit less so for the other proposed options. The impact of this risk is very severe because this content would be entirely inaccessible to some users with absolutely no recourse. For HTML, this was addressed by adding clear, firm, normative guidance about when it is inappropriate to use inert. If something like this is added to CSS, I think it is critical that similar normative guidance is included. I understand there may be reluctance to do this given that CSS is primarily associated with presentation, but since this has such a severe impact on semantics, I think omitting such guidance could be very harmful for accessibility. |
Thanks for the context @jcsteh, this makes sense. I agree that we should at minimum have strong guidance on how to use this to avoid its misuse. Options based on 2 would nicely ensure that content that a11y APIs can see the same content that sighted users can. I'd be interested to determine to what extent we might be able to automatically infer the other use cases @emilio had in mind. E.g. we could also apply inertness on other common cues like
It's worth noting that our resolution in #8389 technically allows making content inert via CSS (demo): .inert {
/* Immediately starts a transition to display: none */
transition: display 10000000s allow-discrete;
/* Since the underlying display value is none, this is treated as inert per resolution in #8389 */
display: none;
@starting-style {
/* Starts visible to trigger the transition. */
display: block;
}
} I think that we should try for an automatic mechanism to the extent we can detect visible content (option 2). I'm open to suggestions for how to recognize other cases where developers want to have displayed content that is not meant to be seen or interacted with. |
From #10711 (comment)
@emilio can you comment as to whether there are other signals for detecting elements that are not visible on screen which could allow us to automatically handle the use case you had in mind? Do you think this Is something that we could upgrade the API with if we thought of ways to detect content not being visible similar to it being clipped by an overflow scroller? |
From a high level I don't see anything harmful about having inertness available in CSS. It's worth having a discussion on whether it can be undone in a subtree somehow. To me that is beneficial. I don't see any major downside that would be bigger than the benefit of allowing that. |
is i'd be warry of doing anything with also agree with aaron that generally i think applying inertness with CSS could be handy. it'd make some UI a lot easier to build due to the lack of the only worry i have with that is inadvertently making content not inert when it really should have been. e.g., marking an element as not inert with CSS which makes sense for that component/in the normal document flow - but then a user invokes a modal dialog. Does that content become inert, stay not inert? Maybe if a modal dialog exists in the top layer, any document-level not-inert content becomes inert. But if someone needed a modal dialog AND a notification popover, well that popover is in the top layer now, and if it was marked as being not-inert, then could help solve stuff like whatwg/html#9936 |
Yup, this is definitely a possible form for option 1!
This is a nice idea, were you thinking that it would actually use opacity, or change the color to have some transparency? Using opacity is a bit tricky since it implicitly affects the way all descendants paint. E.g. <style>
section:not(.active), .inert {
visibility: inert;
}
</style>
<section>
<p>This is some <i>inert</i> content</p>
<div class="inert">
<p>This content is also inert</p>
</div>
</section> If visibility implies / sets As such, I think changing the transparency on the color makes more sense, as it doesn't make its descendants even more transparent and can be easily undone in a
+1 I agree. We should avoid this as a trigger.
I think the computed inertness should probably take into account more than just this property. E.g. maybe you wouldn't be able to undo inertness when it had been set by the HTML mechanism or dialog. |
i was just thinking in general - i wasn't trying to imply it should necessarily be opacity, and i think your rational is a good reason as to why that wouldn't be the best way forward. So long as any content of the inert container can be made to look dimmed in some way (text and graphics) then that sounds like a win to me. If only color transparency can be modified, then that makes me wonder if graphics would appear dimmed or not. maybe not the worst thing if they aren't / leave it up to the authors to do that themselves using whatever they see fit.
fair. just trying to provide an example of where this could be helpful / where there is no way to un-inert such content with HTML alone. |
From the discussions from a11y experts I'm hearing some good arguments for augmenting visibility. Proposal: visibility: hidden | inert | visible; This would:
|
I wonder how backwards compatible that is if we make the HTML attribute use that. Existing code that uses visibility along with inert would change behavior potentially |
I suspect the computed inertness would have to enforce inertness implied by the html attribute, so you could only uninert content made inert by |
Ideally you'd be able to define HTML inertness in terms of UA styles if we introduce something like this |
Experimental prototype based on the proposal in [1] [1] w3c/csswg-drafts#10711 (comment) Change-Id: Ifa7e3923b84cdf4c252d2fade18aaa2b0c3bbc9c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5850197 Commit-Queue: Rune Lillesveen <futhark@chromium.org> Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org> Cr-Commit-Position: refs/heads/main@{#1354394}
We could certainly try to define HTML inertness as a UA stylesheet rule:
We would need to measure how often sites are specifically adding We might still want an exception for the dialog case to be unable to remove inertness outside of the modal dialog, though I don't think this breaks specifying HTML inert in terms of CSS inertness. |
I'm afraid there could be a lot: very often authors implement some toggles visibility by assigning both That said, the combination of this with the |
In #11178 I've drafted up the text for 'interactivity'. I also have a suggested UA stylesheet rule to move the 'inert' attribute behavior over to CSS; it applies
|
@tabatkins I'm confused: |
@emilio Yup, I just forgot how inheritance works. |
* [css-ui-4] Add 'interactivity' property, per #10711 * [css-ui-4] Sigh, inheritance *does* work on the flat tree, I'm dumb. * [css-ui-4] Ensure 'interactivity' can make things inert, but can't *escape* inertness; defer more to the host language.
For anyone else following this issue, there has been some activity in w3ctag/design-reviews#1055. I would recommend reading at least these four comments:
Also, I was surprised to see that |
https://silkhq.co - creator https://x.com/brunostasse When asked why they didnt use popover or dialog, the response was a set of use cases that CSS interactivity would be the right fit for. Issues with
Use cases for consideration to the group:
So this is all even trickier when you stack pages, sheets, etc. A lot of scenarios are possible. Having it in CSS would be very useful to be able to set it based on media/container queries and other selectors on first render. Everything is better in CSS anyway because of this reason. HTML don't have queries and selectors, so it requires JS for everything. <end of Bruno's comments /> Dialog that's been shown modally but a notification/toast comes in…. Inert causing people to do wierd stuff to make the UX work We're seeing very slow adoption for Dialog because of both inert complexity of when it's the right choice, it's power, the lack of easy stacking of multiple items in the top layer and the lack of library adoption. The biggest issue tending to be inert, and folks feeling timid or not knowing you can use dialog non-modally, but also, confusion about why and when you need to orchestrate all this focus. Next biggest is that in your app, if you put 1 thing in the top layer, you tend to have to start putting everything that overlays in a top layer: aka, it doesnt have a good slow adoption story, it's you either put all things in there (tooltips that need to show on top of a modal dialog, multi-layering partial views that open other partial views, etc) There's also the use case difference between inert and interactivity, where interactivity isnt a CSS replacement of inert, it offers subtly different results which are helpful to authors who are well intentioned and orchestrating lots of dynamic focus moments (like with Silk and many of it's demos). For CSS overflow markers: there's a lot of folks out there with very good intent on shipping meaningful keyboard and screen reader interactions who are struggling with the current tools. tldr;
|
I need to step away from this for a bit; it's been exceptionally stressful trying to engage on this topic when there doesn't appear to be a genuine effort made to understand and engage with (not just rebut) the feedback others and I are giving on accessibility. Some brief thoughts, however:
(I'm copy-pasting this comment in a few places because this conversation has been so widely distributed. I apologise for the noise.) |
Nothing to add other than echoing @alice 's concerns here. There seems to be a lot of hurried movement on this, when it should be much more carefully considered for accessibility. |
I would really like to echo to the call to consider the concerns raised by a large number of people now... I think we could schedule a special joint breakout session on this @astearns ? I'd also like to link openui/open-ui#559 as I think that some of the things discussed there are applicable here too. In other words, It seems very probable to me that the more complex use cases (those which couldn't be met by just doing the thing everyone was much more comfortable with) are actually just "similar" in some ways, but probable not "the same" and require a lot more? |
+1 to @alice's post. Some responses to @flackr's comment. First regarding the 3 points raised:
Next, regarding:
I can follow this rational for the carousel use case - not wanting to have a user have access to content that is obscured/off screen. That's where the idea of off-screen inert makes sense to me. But where this response lost me was specifically with "to navigate the page" - as this seems like it's opening up the use case for making visible focusable elements of the page inert, beyond the carousel use case. The part that really stands out to me as needing stronger guardrails and understanding for appropriate use is this comment:
I think this speaks to @alice's point that some of the concerns being raised aren't being fully appreciated, at least not consistently. For instance, this particular response doesn't acknowledge that CSS could be misused to make visible / unobscured content inert that isn't interactive - though in a previous codepen it was acknowledged that both editable content and important non-interactive content could be made inert. So, I realize I'm not saying anything here that is new information or incorrectly imply that this isn't a known pitfall. I'm commenting directly on that last statement because it is at odds with the previous demonstration of how this is not just an AT issue. Beyond that example where someone might find something amiss because interactive content can't be clicked/focused - an author could erroneously mark static content as inert and never realize the full impact of that - much in the way people have commonly misused For some more context, Finally, briefly touching on adam's comment:
To me this seems more like something the browser should be able to do automatically - rather than leaving it up to the author to have to know to do this. That really seems like an unnecessary requirement for authors, especially since the browser is already performing some magic in generating / slotting these markers, anyway... That's all I can muster for now.... there are far more points to raise - and even going back and forth on individual use cases isn't really acknowledging all the other use cases none of us have even thought to talk about yet. There is potential to make something really useful here - at least for specific use cases where misuse can be prevented. I just don't want to see this become the |
I apologize, I never meant to imply that it was not possible to misuse, and as you have noted I have myself written examples of how the ability to inert (in the forms we have it and in the forms we may introduce it) can be misused in a way that could go overlooked. In this statement, I was only contrasting it with properties which have absolutely no effect for non AT users. In particular, making content inert means that it cannot be interacted with, the text cannot be selected or found by find in page, and the content can never be the target of any input events, meaning that it is more likely a developer or users who are not specifically using AT will catch these misuses. I fully acknowledge that it is possible to misuse in a way that could be overlooked by typical user flows. In the interest of completeness, there are also many ways for developers to misuse css properties to hide content in ways that do not remove it from the AT tree resulting in confusing extra content (e.g. opacity: 0, transform: translateX(-100%) in a clipping container, etc).
Is this the best place to carry on this conversation? If so, shall we point the other locations to this issue? I am happy to discuss and provide relevant context related to the many points you have raised in the hopes that it may further advance the conversation.
I completely agree, and we resolved on the fix for this in #11746 and have updated the chromium implementation accordingly. |
The ability to escape inertness has been identified as a risk and confusing deviation from the capability of HTML inert. While there are use cases for this, we think that out of caution it would be safer to align with HTML inert for the currently specifiable inert value until we have time to carefully work through how best to address uninerting use cases. If we are agreed on this point, it seems to me that this should no longer be an inherited property. Adding to the agenda to resolve on this. |
My concern is that removing the inheritance increases the complexity - developers might implement error-prone workarounds that could actually worsen accessibility rather than improve it Future "clever" css tricks might be: html:has(.focus-trap) :where(*, *::before,*::after) {
interactivity: inert;
}
.focus-trap *,
.focus-trap *::before,
.focus-trap *::after {
interactivity: auto;
} |
@jantimon, I think the point is you wouldn't be able to have interactive donut holes like that. |
@benface thank you that helped I still believe this idea could have exactly the opposite effect of what's intended and lead to even worse workarounds. The API won't change the fact that this exact requirement exists on very, very many websites. Devs who are asked to implement such a requirement might reach out to a workaround like this: html:where(:has(.no-inert)) *:where(:not(:has(.no-inert))) {
interactivity: inert;
}
.no-inert, .no-inert * {
interactivity: auto;
} |
The CSS Working Group just discussed
The full IRC log of that discussion<dandclark> masonf: There is an HTML spec PR for this<dandclark> ...It's connecting to CSS concept of interactivity. There have been changes. Part of what's in PR will change <dandclark> ...it keeps existing behavior for modal dialogs. It allows interactivity keyword in CSS to cause intertness. It explains the existing inter attr in terms of that property <dandclark> ...allows to you de-inert things. <dandclark> ...Can exempt subtree to be un-intert. that's expected to change <dandclark> flackr: We're proposing to discuss not de-inerting anymore. Have the interactivity prop be synonomous with the HTML prop <dandclark> ...can't escape inertness aside from preexisting dialog semantics (which is internal magic) <dandclark> flackr: It becomes non-inherited property. <dandclark> ...The way you determine inertness is once you see inert at any point in tree, applies to all descendants, just like inert attribute <dandclark> annevk: Why do we need interactivity property? <dandclark> flackr: So it can be applied dynamically by CSS. Lots of cases where it's useful <jarhar> dandclark: do we still have a11y folks involed in this conversation? <jarhar> dandclark: theyre interested in this conversation, i hope theyre still involved <dandclark> flackr: This has been ongoing discussion <dandclark> ...you can see in various issues <dandclark> ...change to interactivity is part of attempt, if we allign with HTML intert prop, it has the same implications as we already have for that <dandclark> ...nice cleanup, it explains HTML prop like display:none explains hidden property <dandclark> masonf: This change is a result of those convos <dandclark> astearns: This seems like a necessary change, but not sure it's suffiient to address all concerns from a11y folks <dandclark> flackr: Synonymouse with HTML inert <emilio> q+ <dandclark> ...can argue it can be used more broadly now. But seems prescriptive to tell authors they can't do this with CSS when they can with HTML <dandclark> astearns: Requires AT to update that it's not just HTML <dandclark> flackr: This is just a browser thing <dandclark> masonf: Right, should be exposed to AT in the same way <astearns> ack emilio <dandclark> emilio: As part of this work are you chaning HTML inert from being magic to be mapped to CSS prop <dandclark> masonf: Answer is yes. There is still magic because dialogs get to de-inert things magically <dandclark> annevk: Will CSS define all the inert logic? Moving that from HTML? <dandclark> masonf: No, defined in both places <dandclark> annevk: Hows' that make sense <dandclark> masonf: HTML spec PR refers to both CSS and HTMl concept of inert <dandclark> annevk: That' snot what you said before <dandclark> masonf: You said the concept of ineert, which is defined in both places <dandclark> masonf: Both mechanisms apply concept of inertnesss to tree <dandclark> ntim: I think anne is referring to conecept of inertness, not the attribute. Why not move the whole def to CSS? <dandclark> flackr: It's editorial <dandclark> ...can define in CSS if that makes more sense <dandclark> masonf: It's already defined in CSS, but yes let's get the language right, any of these are fine <masonf> CSS concept: https://drafts.csswg.org/css-ui-4/#inert <dandclark> annevk: I'm not sure it's editorial. If we move these concepts, we'll have to change a bunch of thigns <dandclark> ...Then css has to be in charge of interactivity, whether nodes are interactive <dandclark> masonf: I think it does, pasted link above^ <dandclark> annevk: Identically to what we have in HTML? <dandclark> masonf: HTML links to that definition <dandclark> masonf: The behaviors come from CSS <dandclark> annevk: It's not just editorial. Are the behaviors identical? <dandclark> masonf: My PR removes some of these defs and refers to CSS <dandclark> annevk: But not removing the entire concept <dandclark> annevk: Concept could live in CSS, if identical <dandclark> masonf: I agree <dandclark> astearns: Makes sense to ensure we are defining something identical. But editorial in that it's something we need to work through once we decide the design we've got is what we want to move forward with with. <dandclark> ...whether we have interactivity prop is the more fundamental question, not sure we're there yet <dandclark> ...Hope this change will address the a11y concerns but need to ensure that's the case <dandclark> ...We don't yet have resolution to make interactivity not inherit. Can we resolve? <dandclark> s/Synonymouse/synonymous <dandclark> emilio: Can we resolve in this meeting? <dandclark> astearns: Yes, it's joint meeting <dandclark> annevk: Assumption is that the a11y people not in room agree with this <dandclark> flackr: It's one of the things that have been identified, is a move in the right direction <dandclark> ...remaining concern is whether you should be able to set inertness from CSS at all <dandclark> annevk: Yes that seems separate <dandclark> astearns: But very relevant <dandclark> flackr: But you can, with visibility: hidden <dandclark> Proposed resolution: Make interactivity not inherit. <RRSAgent> I'm logging. Sorry, nothing found for 'link' <RRSAgent> I'm logging. Sorry, nothing found for 'logs' <dandclark> <wordsmithing resolution> <RRSAgent> I have made the request to generate https://www.w3.org/2025/05/15-css-minutes.html annevk <dandclark> Proposed resolution: Interactivity does not inherit, and setting it on something that's inert does not change the intertness <masonf> +1 <flackr> +1 <dandclark> RESOLVED: Interactivity does not inherit, and setting it on something that's inert does not change the intertness <ntim> s/intert/inert :) <dandclark> astearns: I know this CSS prop is important to carousel set of proposals. What happens if there isn't interactivity property? <dandclark> flackr: For a bunch of use cases they'll have to add prop via JS <dandclark> vmpstr: Or they'll add visibility but that limits the effects you can have <dandclark> flackr: Visually changes the things that are not current <dandclark> ...When scrolling, you would see the new contents pop into visibility as it becomes active <dandclark> ...In many use cases you can peek at next content <dandclark> ...Interactivity prop supports this <dandclark> astearns: Can't do this another way? <dandclark> flackr: Right <dandclark> astearns: Other questions or comments? <dandclark> ...before we take it back to issue <dandclark> masonf: I will update to incorporate the resolution, would like review after that <dandclark> astearns: And you'll remove special casing for setting things uninert? <dandclark> masonf: Right <jarhar> https://github.com/whatwg/html/issues/8189#issuecomment-2877242732 |
Can someone clarify the practical impact of this resolution? The most recent editor's draft (last updated April 14, 2025) already includes this note:
My understanding is: Previously, If that is correct, then I think this is a good change! |
Just to verify, this means |
Problem
Tab and carousel UI patterns that can be mostly created with pure HTML and CSS. #9745 is aiming to expand upon how rich of an experience can be declaratively built. The primary use cases explored here are scrolling paginated tabs or carousels. E.g.
The ARIA Authoring Practices Guide recommends that only the currently visible content is in the focus order, and has examples which achieve this either by:
aria-hidden
from script (example 3).In many cases, display: none can't be used, e.g. in most of the above cases because the previous and next slide may be visible simultaneously. However, since the alternative is an HTML attribute, it requires developers to write script that listens to the appropriate events and set these states, which can be a tricky to correctly detect and is unfortunate to need for cases where the interaction is otherwise declarative (e.g. scrolling or anchor links).
Proposal
I believe there are a few ways we could approach this problem:
interactivity: auto | inert
which was previously deferred in [css-ui] Should inertness be exposed as CSS property? #7021 awaiting better use cases. This has the potential to help with animation related cases, e.g. [css-display] Interaction gotchas when delaying the effect ofdisplay: none
#8389 where we currently try to infer this temporarily visible but inert state from the underlying style. With this property, developers would still need to have a way to trigger this style change as a result of whether something is currently visible which could be based on a view-timeline, e.g.::snapped
query as in [css-scroll-snap] Proposing:snapped
: exposing private snapped item browser state for developers and designers #6985:overflow-interactivity: auto | inert
. This would make content that does not intersect the optimal viewing region of the scrolling container inert as it would be if it weredisplay: none
.inert=offscreen
which could behave either like option 1 or 2 depending on which made more sense.The text was updated successfully, but these errors were encountered: