Skip to content
This repository was archived by the owner on Mar 4, 2020. It is now read-only.

Commit 3d4af74

Browse files
authored
feat(Accessibility): Add roles to Popup's content in accessibility behavior (#1253)
* feat(Accessibility): Add roles to Popup's content in accessibility behavior * update changelog
1 parent a43f4d7 commit 3d4af74

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
2525

2626
### Features
2727
- Move `Input` styles to Base theme @layershifter ([#1247](https://github.com/stardust-ui/react/pull/1247))
28+
- Add `role` attribute to `Popup`'s content in accessibility behaviors @sophieH29 ([1253](https://github.com/stardust-ui/react/pull/1253))
2829

2930
<!--------------------------------[ v0.28.1 ]------------------------------- -->
3031
## [v0.28.1](https://github.com/stardust-ui/react/tree/v0.28.1) (2019-04-23)

packages/react/src/lib/accessibility/Behaviors/Popup/popupBehavior.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import * as _ from 'lodash'
88
*
99
* @specification
1010
* Adds attribute 'aria-disabled=true' to 'trigger' component's part if 'disabled' property is true. Does not set the attribute otherwise.
11+
* Adds attribute 'role=complementary' to 'popup' component's part.
1112
*/
1213
const popupBehavior: Accessibility = (props: any) => {
1314
const onAsArray = _.isArray(props.on) ? props.on : [props.on]
@@ -21,6 +22,9 @@ const popupBehavior: Accessibility = (props: any) => {
2122
? true
2223
: undefined,
2324
},
25+
popup: {
26+
role: 'complementary',
27+
},
2428
},
2529
keyActions: {
2630
popup: {

packages/react/src/lib/accessibility/Behaviors/Popup/popupFocusTrapBehavior.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@ import popupBehavior from './popupBehavior'
99
* @specification
1010
* Adds attribute 'aria-disabled=true' to 'trigger' component's part if 'disabled' property is true. Does not set the attribute otherwise.
1111
* Adds attribute 'aria-modal=true' to 'popup' component's part.
12+
* Adds attribute 'role=dialog' to 'popup' component's part.
1213
* Traps focus inside component.
1314
*/
1415
const popupFocusTrapBehavior: Accessibility = (props: any) => {
1516
const behaviorData = popupBehavior(props)
1617
behaviorData.attributes.popup = {
1718
...behaviorData.attributes.popup,
1819
'aria-modal': true,
20+
role: 'dialog',
1921
}
2022
behaviorData.focusTrap = true
2123

0 commit comments

Comments
 (0)