@brightspace-ui/core 3.28.7 → 3.30.0
Sign up to get free protection for your applications and to get access to all the features.
- package/components/overflow-group/README.md +25 -3
- package/helpers/README.md +3 -0
- package/helpers/focus.js +19 -0
- package/package.json +1 -1
@@ -1,7 +1,7 @@
|
|
1
1
|
# Overflow Groups
|
2
|
-
|
2
|
+
An Overflow Group adds responsive behaviour to a group of buttons, links, or menus.
|
3
3
|
|
4
|
-
<!-- docs: demo autoSize:false display:block size:
|
4
|
+
<!-- docs: demo autoSize:false display:block size:small -->
|
5
5
|
```html
|
6
6
|
<script type="module">
|
7
7
|
import '@brightspace-ui/core/components/overflow-group/overflow-group.js';
|
@@ -26,11 +26,27 @@ The `d2l-overflow-group` element can be used to add responsiveness to a set of b
|
|
26
26
|
<d2l-button>Delete</d2l-button>
|
27
27
|
</d2l-overflow-group>
|
28
28
|
```
|
29
|
+
## Best Practices
|
30
|
+
|
31
|
+
<!-- docs: start best practices -->
|
32
|
+
<!-- docs: start dos -->
|
33
|
+
* Use when grouping 3 or more adjacent actions
|
34
|
+
* Consider whether visible actions can be reduced
|
35
|
+
* Use `max-to-show` to set an upper limit on how many actions are displayed before overflowing; this can prevent users from feeling overwhelmed with top-level choices
|
36
|
+
* Use the `subtle` `opener-style` if the actions are [Subtle Buttons](../../components/button#d2l-button-subtle)
|
37
|
+
<!-- docs: end dos -->
|
38
|
+
|
39
|
+
<!-- docs: start donts -->
|
40
|
+
* Avoid using `min-to-show` unless users are heavily impacted when the first 1 or 2 actions overflow into the More Actions menu
|
41
|
+
* Don't use the `icon` `opener-type` unless it's for page-level actions in the top right corner of the page, or if space is severely limited
|
42
|
+
<!-- docs: end donts -->
|
43
|
+
<!-- docs: end best practices -->
|
29
44
|
|
30
45
|
## Overflow Group [d2l-overflow-group]
|
46
|
+
|
31
47
|
Items added to this container element will no longer wrap onto a second line when the container becomes too small, but will be added to a dropdown menu with configurable styling.
|
32
48
|
|
33
|
-
<!-- docs: demo code properties name:d2l-overflow-group sandboxTitle:'Overflow Group' autoSize:false display:block size:
|
49
|
+
<!-- docs: demo code properties name:d2l-overflow-group sandboxTitle:'Overflow Group' autoSize:false display:block size:small -->
|
34
50
|
```html
|
35
51
|
<script type="module">
|
36
52
|
import '@brightspace-ui/core/components/overflow-group/overflow-group.js';
|
@@ -108,3 +124,9 @@ getOverflowContainer(overflowItems, mini) {
|
|
108
124
|
else return html`<d2l-dropdown-button text="Overflow Menu"><d2l-dropdown-menu>${overflowItems}</d2l-dropdown-menu></d2l-dropdown-button>`;
|
109
125
|
}
|
110
126
|
```
|
127
|
+
|
128
|
+
## Accessibility
|
129
|
+
|
130
|
+
Navigation and focus order are impacted when items overflow the viewport; they are physically moved into the More Actions menu. Since this effect is not limited to visual presentation, it affects both screen reader users and sighted users equally.
|
131
|
+
|
132
|
+
The accessibility and keyboard interaction of the More Actions menu aligns with [W3C's best practices for menus](https://www.w3.org/WAI/ARIA/apg/patterns/menubar/) — see [Menu](../menu) for more information.
|
package/helpers/README.md
CHANGED
@@ -126,6 +126,9 @@ getComposedActiveElement()
|
|
126
126
|
// gets the first focusable descendant given a node, including those within the shadow DOM
|
127
127
|
getFirstFocusableDescendant(node, includeHidden, predicate, includeTabbablesOnly)
|
128
128
|
|
129
|
+
// gets the focusable elements within the specified element
|
130
|
+
getFocusableDescendants(node, { deep: false, disabled: false, hidden: false, predicate: elem => false, tabbablesOnly: true })
|
131
|
+
|
129
132
|
// gets the focus pseudo-class to used in selectors (focus-visible if supported, or focus)
|
130
133
|
// Usage:
|
131
134
|
// css`
|
package/helpers/focus.js
CHANGED
@@ -40,6 +40,25 @@ export function getFirstFocusableDescendant(node, includeHidden, predicate, incl
|
|
40
40
|
return null;
|
41
41
|
}
|
42
42
|
|
43
|
+
export function getFocusableDescendants(node, options) {
|
44
|
+
let focusables = [];
|
45
|
+
|
46
|
+
const composedChildren = getComposedChildren(node);
|
47
|
+
composedChildren.forEach(child => {
|
48
|
+
if (child.tagName === 'svg') return;
|
49
|
+
if (options?.predicate) {
|
50
|
+
if (!options.predicate(child)) return;
|
51
|
+
}
|
52
|
+
|
53
|
+
if (isFocusable(child, options?.hidden, options?.tabbablesOnly, options?.disabled)) focusables.push(child);
|
54
|
+
if (options?.deep) {
|
55
|
+
focusables = [...focusables, ...getFocusableDescendants(child, options)];
|
56
|
+
}
|
57
|
+
});
|
58
|
+
|
59
|
+
return focusables;
|
60
|
+
}
|
61
|
+
|
43
62
|
export function getFocusPseudoClass() {
|
44
63
|
return isFocusVisibleSupported() ? 'focus-visible' : 'focus';
|
45
64
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@brightspace-ui/core",
|
3
|
-
"version": "3.
|
3
|
+
"version": "3.30.0",
|
4
4
|
"description": "A collection of accessible, free, open-source web components for building Brightspace applications",
|
5
5
|
"type": "module",
|
6
6
|
"repository": "https://github.com/BrightspaceUI/core.git",
|