-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[added] Prop for adding aria-hidden to application element (#8)
This makes it so that when provided function that returns a DOM node to the getAriaHideElement prop, it will augment that element with the aria-hidden attribute effectively hiding everything except the tray from screenreaders.
- Loading branch information
1 parent
765c5b8
commit 7a316ff
Showing
4 changed files
with
62 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// Adapted from https://github.com/react-bootstrap/react-prop-types/blob/master/src/isRequiredForA11y.js | ||
export function a11yFunction(props, propName, componentName) { | ||
if ((!props[propName]) || (typeof props[propName] !== 'function')) { | ||
return new Error( | ||
`The prop '${propName}' is required to make '${componentName}' fully accessible. ` + | ||
`This will greatly improve the experience for users of assistive technologies. ` + | ||
`You should provide a function that returns a DOM node.` | ||
); | ||
} | ||
} |