Skip to content

Multiple toggle targets - #44

Open
julianrubisch wants to merge 3 commits into
hopsoft:mainfrom
julianrubisch:multiple-toggle-targets
Open

julianrubisch wants to merge 3 commits into
hopsoft:mainfrom
julianrubisch:multiple-toggle-targets

Conversation

@julianrubisch

Copy link
Copy Markdown
Collaborator

This PR allows to toggle multiple targets in a way that adheres to the aria-controls specification 🎉

Specifically, I've expanded the targetElement to a list of elements defined by a list of IDs in aria-controls where applicable.

Here's a quick example repo: https://github.com/julianrubisch/turbo_boost-elements-test. Firing this up and adding a post, you should get this:

CleanShot.2023-07-17.at.14.02.02.mp4

There's a final TODO I haven't yet tackled: https://github.com/hopsoft/turbo_boost-elements/compare/main...julianrubisch:turbo_boost-elements:multiple-toggle-targets?expand=1#diff-cb87972fc68e152400f137350beab0650332a06e765d64044854eb6c6a4a0f78R105

Also, to stay consistent with the single-item case, I check whether any of the controlled DOM ids is expanded: https://github.com/hopsoft/turbo_boost-elements/compare/main...julianrubisch:turbo_boost-elements:multiple-toggle-targets?expand=1#diff-0d05fcbb54bf4cb3d6e33827837c58e3ef26562c08cb80740721a5110eb09257R85 - Should this be an .all? ? I should note that I've not yet thought about the "mixed" case, where some elements are expanded and others aren't.

We will have to tend to the devtools separately, they're currently only pointing at the first targetElement.

@julianrubisch
julianrubisch requested a review from hopsoft July 17, 2023 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant