Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow sync group ID to be specified explicitly #52

Closed
mojavelinux opened this issue Jan 31, 2023 · 1 comment
Closed

Allow sync group ID to be specified explicitly #52

mojavelinux opened this issue Jan 31, 2023 · 1 comment
Assignees
Labels
Milestone

Comments

@mojavelinux
Copy link
Member

mojavelinux commented Jan 31, 2023

Currently, the sync group ID is derived automatically by joining the sync ID of each tab in the tablist. This mandates that tabs blocks be congruent (i.e., have the same tablist) in order to participate in the same sync group. Allow this group ID to be overridden so tabs blocks which are non-congruent (i.e, have a different tablist) can participate in the same sync group.*

The group ID can be specified using the sync-group-id attribute on the block. For example:

[tabs]
====
A:: A
B:: B
====

[tabs,sync-group-id=A|B]
====
A:: A
B:: B
C:: C
====

Since Asciidoctor doesn't currently support passing through data attributes to the HTML, use a CSS class to pass this attribute (e.g, data-sync-group-id=A|B). The tabs script will need to detect the presence of this CSS class and convert it to a data attribute in place of the automatically derived one.

* Keep in mind that if a tab is selected that's not in other tabs blocks in the same group, the default tab for that tabs block will be selected when the page is reloaded.

@mojavelinux mojavelinux added the enhancement New feature or request label Jan 31, 2023
@mojavelinux mojavelinux added this to the v1.0.x milestone Jan 31, 2023
@mojavelinux mojavelinux self-assigned this Jan 31, 2023
mojavelinux added a commit to mojavelinux/asciidoctor-tabs that referenced this issue Jan 31, 2023
…an derived using the sync-group-id attribute on the tabs block
mojavelinux added a commit to mojavelinux/asciidoctor-tabs that referenced this issue Jan 31, 2023
…an derived using the sync-group-id attribute on the tabs block
@mojavelinux
Copy link
Member Author

If the sync group ID contains spaces, replace them with a no-break space in the HTML, the convert those characters back to a space when initializing the tabs. This replacement prevents the DOMTokenList from breaking up the value.

mojavelinux added a commit to mojavelinux/asciidoctor-tabs that referenced this issue Jan 31, 2023
…an derived using the sync-group-id attribute on the tabs block
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant