Ancestors

Toot

Written by Luke on 2025-01-31 at 19:47

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

Descendants

Written by Curtis Wilcox on 2025-02-01 at 00:08

@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

Written by Curtis Wilcox on 2025-02-01 at 00:08

@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

Written by Luke on 2025-02-01 at 18:04

@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

Written by Curtis Wilcox on 2025-02-01 at 18:15

@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

Proxy Information
Original URL
gemini://mastogem.picasoft.net/thread/113924691920139831
Status Code
Success (20)
Meta
text/gemini
Capsule Response Time
275.79346 milliseconds
Gemini-to-HTML Time
1.171087 milliseconds

This content has been proxied by September (3851b).