MCPcopy Create free account
hub / github.com/bytecodealliance/component-docs / syncContainer

Function syncContainer

component-model/theme/tabs-a11y.js:47–58  ·  view source on GitHub ↗
(container)

Source from the content-addressed store, hash-verified

45 }
46
47 function syncContainer(container) {
48 container.querySelectorAll('.mdbook-tab').forEach(function (tab) {
49 const isActive = tab.classList.contains('active');
50 tab.setAttribute('aria-selected', isActive ? 'true' : 'false');
51 // Roving tabindex: only the active tab is reachable via Tab key;
52 // arrow keys move focus within the tablist.
53 tab.setAttribute('tabindex', isActive ? '0' : '-1');
54 });
55 container.querySelectorAll('.mdbook-tab-content').forEach(function (pane) {
56 pane.setAttribute('aria-hidden', pane.classList.contains('hidden') ? 'true' : 'false');
57 });
58 }
59
60 function syncAll() {
61 document.querySelectorAll('.mdbook-tabs-container').forEach(syncContainer);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…