You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
♻️ REFACTOR: Reduce JS/CSS size and improve accessibility (#94)
Removes:
* semantic-ui assets
* unused 'sphinx_tabs_nowarn' sphinx option
Changes:
* tab structure to use tab roles
* tab label colour, to increase contrast with background
* assets are now copied across by sphinx rather than explicitly in the extension
Adds:
* tabindex atributes to allow users to focus and switch tabs using a keyboard (left and right arrows, and enter key to change)
* ARIA labels for tabs and panels
* ability to close tabs panel by clicking open tab
* persistence of last selected group or code tab during the session (when session storage is permitted)
* margin below images inside tab content
Copy file name to clipboardExpand all lines: README.md
+15-7Lines changed: 15 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -73,10 +73,14 @@ Basic tabs can be coded as follows:
73
73
74
74

75
75
76
+
The contents of each tab can be displayed by clicking on the tab that you wish to show. Clicking on the tab that is currently open will hide the tab's content, leaving only the tab set labels visible.
77
+
78
+
Alternatively, tab sets can be focused using :kbd:`Tab`. The :kbd:`Left Arrow` and :kbd:`Right Arrow` keys can then be used to navigate across the tab set and :kbd:`Enter` can be used to select a tab.
79
+
76
80
## Grouped Tabs
77
81
78
-
Tabs can be grouped, so that changing the current tab in one area changes the current tab in the
79
-
another area. For example:
82
+
Tabs can be grouped, so that changing the current tab in one tabset changes the current tab in all other tabsets containing a tab with a matching label.
83
+
For example:
80
84
81
85
```rst
82
86
.. tabs::
@@ -110,9 +114,12 @@ another area. For example:
110
114
111
115

112
116
117
+
If permitted by the user's browser, the last selected group tab will be remembered when changing page. As such, if any tabsets on the next page contain a tab with the same label it will be selected.
118
+
119
+
113
120
## Code Tabs
114
121
115
-
Grouped tabs containing code areas with syntax highlighting can be created as follows:
122
+
Grouped tabs containing code with syntax highlighting can be created as follows:
116
123
117
124
```rst
118
125
.. tabs::
@@ -152,9 +159,11 @@ Grouped tabs containing code areas with syntax highlighting can be created as fo
152
159
END PROGRAM main
153
160
```
154
161
155
-
Code tabs also support custom lexers (added via sphinx `conf.py`).
162
+

163
+
164
+
Code tabs also support custom lexers (added via sphinx `conf.py`). Pass the lexers alias as the first argument of `code-tab`.
156
165
157
-
By default, code tabs are labelled with the language name, though can be provided with custom labels like so:
166
+
By default, code tabs are labelled with the language name, though a custom label can be provided as an optional second argument to the `code-tabs` directive:
158
167
159
168
```rst
160
169
.. tabs::
@@ -172,8 +181,7 @@ By default, code tabs are labelled with the language name, though can be provide
172
181
173
182
```
174
183
175
-
176
-

184
+
The tab label is used to group tabs, including `code-tabs`. As such, the same custom label should be used to group related tabs.
0 commit comments