Behaviour SwRS-MDOKFSTUDIO-MYST-098
Tab sets render a tab bar with one panel shown at a time
When a document holds a {tab-set} with {tab-item} children, the extension SHALL render a tab bar with ARIA tab roles and the tab-item titles, show only the panel of the selected tab (the :selected: item, else the first), keep every tab item a block that edit mode edits on its own source lines, and keep :sync: keys on the tabs.
Step 1 of path 2 in StRS-MDOKFSTUDIO-MYST-016: from “A document holds a tab set with tab items” to “The tab bar shows the selected panel”.
Scenarios 3
The situations the tests check; open one to read it.
nominalA tab set renders a tab bar and the selected panel
Givena `{tab-set}` of the `{tab-item}`s Python, Node (with `:selected:`) and Shell, each with a body
Whenthe preview renders
Thena `tablist` holds one `tab` button per item, each wired by `aria-controls` and `aria-labelledby` to its `tabpanel`, the Node tab has `aria-selected="true"` and `tabindex="0"` (the others `false` and `-1`), and only the Node panel is shown (the others carry `hidden`)
boundaryTab set options and contents
| Input | Outcome |
|---|---|
| no `:selected:` item | the first tab is selected |
| `:sync: key` on an item | the tab carries `data-myst-tab-sync` |
| `:sync-group: name` on the set | the set carries `data-myst-tab-group`, `tab` when absent |
| a title with Markdown or a link | the tab label is its plain text |
| a grid, a card, code or another tab set in an item | rendered in the panel; a nested set keeps its own tabs |
| the content of a tab item | its blocks carry marker lines (`data-okf-marker-line`, never a mapped block), so the line marker finds a line inside the panel; a click still edits the whole item |
nominalIn edit mode a tab item is edited on its own lines
Givenedit mode is on
Whena tab is clicked and then its panel
Thenthe click on the tab bar only selects the tab and opens no editor, and the click on the shown panel opens the raw source of that `{tab-item}` only (its own lines), whose tab-set and panels each carry their `data-line` range