Skip to content

Commit d3462b2

Browse files
[toolbar] Add disabled attribute and legend support (#1421)
Co-authored-by: Scott O'Hara <scottaohara@users.noreply.github.com>
1 parent a496140 commit d3462b2

1 file changed

Lines changed: 27 additions & 2 deletions

File tree

site/src/pages/components/toolbar.explainer.mdx

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,28 @@ Use cases:
4343
- Toolbars are displayed horizontally by default.
4444
- Provides correct keyboard navigation behaviour.
4545

46+
```webidl
47+
[Exposed=Window]
48+
interface HTMLToolbarElement : HTMLElement {
49+
[HTMLConstructor] constructor();
50+
51+
[CEReactions, Reflect] attribute boolean disabled;
52+
};
53+
```
54+
55+
Toolbars will support a disabled attribute, when specified it will cause all descendents that support a disabled state to be disabled;
56+
with the exception of any descendents within its first `<legend>` element (this matches fieldset).
57+
58+
### Naming
59+
60+
Toolbars situationally need an accessible name. Naming can become particularly important when there are multiple
61+
toolbars on a page, or in situations where authors provide a visible label for a toolbar, with the intent that it would
62+
serve as the identifier (name) of the toolbar, programmatically.
63+
64+
To facilitate labeling and naming, toolbars will support the `<legend>` element similarly to its use in `fieldset`,
65+
and more recently its allowance within the `optgroup` element.
66+
The first child legend, if present, will be used for calculating the accessible name of the toolbar.
67+
4668
### Keyboard behaviour
4769

4870
This element will implicitly provide the same behaviour as a [toolbar focusgroup](/components/scoped-focusgroup.explainer#supported-behaviors):
@@ -72,10 +94,15 @@ toolbar {
7294

7395
display: inline-flex;
7496
flex-direction: row;
97+
flex-wrap: wrap;
7598
inline-size: max-content;
7699
gap: 0.25em;
77100
padding: 0.25em;
78101
}
102+
103+
toolbar > legend:first-of-type {
104+
flex-bases: 100%;
105+
}
79106
```
80107

81108
## Questions?
@@ -90,8 +117,6 @@ as well as setting aria-orientation appropriately, would solve this? [Issue 1201
90117
## Extra questions
91118

92119
* Does `<toolbar>` support separators? [Issue 1400](https://github.com/openui/open-ui/issues/1400)
93-
* Toolbars generally should be labelled, it is a MUST if there are multiple on a page. Should we support this via HTML,
94-
or still rely on aria? [Issue 1399](https://github.com/openui/open-ui/issues/1399)
95120

96121
## Examples
97122

0 commit comments

Comments
 (0)