-
Notifications
You must be signed in to change notification settings - Fork 55
feat(a11y): add default children behavior to behaviors #1282
Conversation
@@ -160,6 +160,7 @@ export interface AccessibilityDefinition { | |||
focusZone?: FocusZoneDefinition | |||
focusTrap?: FocusTrapDefinition | |||
autoFocus?: AutoFocusZoneDefinition | |||
childrenBehavior?: Accessibility |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would name it childBehavior
as it is only one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But, why it should be single? We also have MenuDivider
that can be iterated in the same scope...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I the sense of AccessibilityBehavior type, it can have only one child behavior. For e.g.
MenuBehavior= (props) => {
...
childBehavior: menuItemBehavior
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not true. menuBehavior
has multiple siblings: menuItemBehavior
, menuDividerBehavior
& submenuBehavior
. I had an offline conversation with @miroslavstastny and we agreed on the same thing that was proposed originally:
menuBehavior= (props) => {
// ...
childBehaviors: {
item: menuItemBehavior,
divider: menuDividerBehavior,
}
}
It allows to override behaviors for all child items and it's aligned with existing structure on attributes
and keyHandlers
. Please take one more look on this change.
packages/react/src/lib/accessibility/Behaviors/Toolbar/toolbarBehavior.ts
Outdated
Show resolved
Hide resolved
Codecov Report
@@ Coverage Diff @@
## master #1282 +/- ##
==========================================
- Coverage 72.77% 72.73% -0.05%
==========================================
Files 736 736
Lines 5627 5633 +6
Branches 1624 1630 +6
==========================================
+ Hits 4095 4097 +2
- Misses 1527 1529 +2
- Partials 5 7 +2
Continue to review full report at Codecov.
|
7784136
to
cc53335
Compare
…-ui/react into feat-children-behaviors
@@ -180,6 +184,7 @@ class Menu extends AutoControlledComponent<ReactProps<MenuProps>, MenuState> { | |||
variables, | |||
styles: styles.divider, | |||
inSubmenu: submenu, | |||
accessibility: accessibility.childBehaviors.divider, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
childBehaviors
is optional, check its existence before accessing divider
@@ -203,6 +208,7 @@ class Menu extends AutoControlledComponent<ReactProps<MenuProps>, MenuState> { | |||
active, | |||
inSubmenu: submenu, | |||
indicator, | |||
accessibility: accessibility.childBehaviors.item, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
childBehaviors
is optional, check its existence before accessing item
Fixes #1008
It adds child behaviors by default to Menu related behaviors: