Skip to content

Commit 101fd8f

Browse files
authored
Add "aria-hidden" and "role" props to usePopover (#4727)
* Add aria-hidden and role props to usePopover
1 parent 2b6302b commit 101fd8f

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

packages/@react-aria/overlays/src/useOverlayPosition.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,8 @@ export function useOverlayPosition(props: AriaPositionProps): PositionAria {
217217
},
218218
placement: position.placement,
219219
arrowProps: {
220+
'aria-hidden': 'true',
221+
role: 'presentation',
220222
style: {
221223
left: position.arrowOffsetLeft,
222224
top: position.arrowOffsetTop

packages/@react-aria/overlays/test/useOverlayPosition.test.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,14 @@ describe('useOverlayPosition', function () {
199199
fireEvent.scroll(window);
200200
expect(onClose).toHaveBeenCalledTimes(1);
201201
});
202+
203+
it('arrow should be hidden when using assistive technologies', function () {
204+
let res = render(<Example />);
205+
let arrow = res.getByTestId('arrow');
206+
207+
expect(arrow).toHaveAttribute('aria-hidden', 'true');
208+
expect(arrow).toHaveAttribute('role', 'presentation');
209+
});
202210
});
203211

204212
describe('useOverlayPosition with positioned container', () => {

0 commit comments

Comments
 (0)