Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Prevent screen reader from focusing content behind Snackbar #422

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@department-of-veterans-affairs/mobile-component-library",
"version": "0.21.1-alpha.0",
"version": "0.21.1-alpha.5",
"description": "VA Design System Mobile Component Library",
"main": "src/index.tsx",
"scripts": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ export default meta

type Story = StoryObj<SnackbarProps>

/**
* Handles rendering the story in non-web platforms to have functional Snackbar
* @param props - Arguments from `args` list
* @returns Flat Button display with onPress logic to pull up the Snackbar
*/
const mobileComponentRenderer = (props: SnackbarProps) => {
const { isError, messageA11y, onActionPressed } = props.data || {}
const onPressSnackbar = () => {
Expand All @@ -53,7 +58,7 @@ export const _Snackbar: Story = {
message: 'Message moved to Test Folder',
data: {
isError: false,
messageA11y: 'Message moved to Custom Folder with a11y',
messageA11y: 'Message moved to Test Folder with accessibility override',
onActionPressed: () => console.log('Action pressed'),
},
},
Expand Down
3 changes: 3 additions & 0 deletions packages/components/src/components/Snackbar/Snackbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,9 @@ export const Snackbar: FC<SnackbarProps> = (toast) => {
// }

const containerProps: ViewProps = {
accessibilityViewIsModal: true, // iOS only
tabIndex: 0, // Android only
// Above props prevent screen reader from tap focusing elements behind the Snackbar
style: {
alignItems: 'center',
backgroundColor: theme.vadsColorSurfaceInverse,
Expand Down
Loading