Ability to disable toggling/closing details #10864
Labels
addition/proposal
New features or enhancements
needs implementer interest
Moving the issue forward requires implementers to express interest
What problem are you trying to solve?
There are several use cases where you would want to disable the opening and closing of
details
– especially as browsers will now automatically toggledetails
based on for example Find in Page:details
where one is always openDetails
When implementing accordions, in some designs it's not appropriate to allow closing of an open details without opening another. This is especially true of "tab-like" accordions. Tabs and Accordions have similarities and are sometimes used interchangeably depending on the viewport size, and in a tabbed interface you typically can't close the active tab without opening another. The desired pattern is similar to the exclusive pattern with the
name
attribute ondetails
, but should also prevent the currently expandeddetails
from being closed. See https://www.makethingsaccessible.com/guides/responsive-and-accessible-tabbed-interfaces/ for some details.Other examples are components where you step through a set of required steps, one expanding after the other. You may be allowed to expand the next steps, but should not be allowed to close the current step until it has been completed. In other cases you should not be able to show the next step until the current one has been completed.
The GitHub Issues reporter is a good example, where you can expand the next sections by interacting with their forms, but you cannot explicitly collapse the section you are current writing in.
What solutions exist today?
You would need to use a
MutationObserver
to reset theopen
state since you cannotpreventDefault
thetoggle
event. You also have to disable keyboard and mouse events onsummary
.VoiceOver currently reports
<summary aria-disabled="true">
as "Disclosure Triangle, dimmed".How would you solve it?
Adding a
disabled
attribute tosummary
:would solve most of the use cases above, even if it would still require tracking of the
open
state in JavaScript to update thedisabled
state accordingly.Anything else?
No response
The text was updated successfully, but these errors were encountered: