If you could have an attribute that allows you to link a button to any element and expand/collapse that element. What would you use it for? Particularly what would it enable that details doesn't today? Asking for reasons...
=> More informations about this toot | More toots from Lukew@toot.wales
@Lukew
Is the idea to have HTML attributes akin to popover
and popoverTarget
but for showing/hiding an element in the document instead of the top layer?
I'd use it instead of details / summary when a button role and heading should be conveyed at the same time.
I'd use it for buttons in navigation to open/close submenus.
If one button could target more then one element, it could toggle all kinds of things, like different sets of pins on a map, or annotations, or markup symbols around color-coded text for people who can't perceive the colors.
I'd use it instead of details / summary entirely if it meant avoiding the bugs in VoiceOver+Safari.
=> More informations about this toot | More toots from cwilcox808@c.im
@Lukew
Like , it would need a declarative option to be initially expanded instead of collapsed. While collapsed would likely be display: none
by default, it should also be possible to make it visibility: hidden
instead.
It could be better for "spoiler" content, like that details / summary 'pen you recently boosted.
=> More informations about this toot | More toots from cwilcox808@c.im
@cwilcox808 so yeah the idea is a new attribute that enables exactly that, my current thinking is it would be display:none by default but would gracefully work with hidden=until-found to then be searchable.
As for the initial state I'm thinking a new attribute called initiallyopen could be made to indicate that.
The declarative button (using command/commandfor) would only support a single target but with a little JS you could do more fancy things.
=> More informations about this toot | More toots from Lukew@toot.wales
@Lukew
I hadn't thought about find-in-page but yes, the author should be able to decide whether the collapsed content should be findable or not. That's an argument for not using details / summary for nav submenus today (though I don't see why that's such a problem).
Details / summary has already broken the seal on using name
for things other than form data and to act on multiple elements based on another's state, it seems like it could be taken further.
It's not like it's hard today to act on multiple elements with JS or with clever uses of :has()
but a declarative approach could be simpler and more performant.
=> More informations about this toot | More toots from cwilcox808@c.im This content has been proxied by September (3851b).Proxy Information
text/gemini