Multiple toggle targets - #44
Open
julianrubisch wants to merge 3 commits into
Open
julianrubisch wants to merge 3 commits into
julianrubisch wants to merge 3 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR allows to toggle multiple targets in a way that adheres to the aria-controls specification 🎉
Specifically, I've expanded the
targetElementto a list of elements defined by a list of IDs inaria-controlswhere 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.