Skip to content

Commit

Permalink
fix: add some a11y props to drawer overlay
Browse files Browse the repository at this point in the history
  • Loading branch information
satya164 committed Nov 27, 2022
1 parent b03f39e commit 0890895
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 4 additions & 1 deletion packages/drawer/src/views/legacy/Drawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -575,10 +575,13 @@ export default class DrawerView extends React.Component<DrawerProps> {
// Disable overlay if sidebar is permanent
drawerType === 'permanent' ? null : (
<Overlay
pointerEvents={isOpen ? 'auto' : 'none'}
progress={progress}
onPress={() => this.toggleDrawer(false)}
style={overlayStyle as any}
accessibilityElementsHidden={!isOpen}
importantForAccessibility={
isOpen ? 'auto' : 'no-hide-descendants'
}
/>
)
}
Expand Down
6 changes: 5 additions & 1 deletion packages/drawer/src/views/modern/Overlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,12 @@ const Overlay = React.forwardRef(function Overlay(
});

const animatedProps = useAnimatedProps(() => {
const active = progress.value > PROGRESS_EPSILON;

return {
pointerEvents: progress.value > PROGRESS_EPSILON ? 'auto' : 'none',
pointerEvents: active ? 'auto' : 'none',
accessibilityElementsHidden: !active,
importantForAccessibility: active ? 'auto' : 'no-hide-descendants',
} as const;
});

Expand Down

0 comments on commit 0890895

Please sign in to comment.