Skip to content

Commit

Permalink
fix: update non-focus-trap Popover role to be group (microsoft#24897)
Browse files Browse the repository at this point in the history
  • Loading branch information
smhigley authored and NotWoods committed Nov 18, 2022
1 parent a64be78 commit 177675f
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "fix: update popover role to be note when it does not trap focus",
"packageName": "@fluentui/react-popover",
"email": "sarah.higley@microsoft.com",
"dependentChangeType": "patch"
}
4 changes: 2 additions & 2 deletions packages/react-components/react-popover/Spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ Default popover
</div>

// on document.body
<div role="complementary">
<div role="group">
{/** content */}
</div>
```
Expand Down Expand Up @@ -499,7 +499,7 @@ Accessible markup is divided into two scenarios:
```tsx
// Popover that does not trap focus
<button aria-expanded="false">Trigger</button>
<div role="complementary">
<div role="group">
No focus trap
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const mount = (element: JSX.Element) => {
};

const popoverTriggerSelector = '[aria-expanded]';
const popoverContentSelector = '[role="complementary"]';
const popoverContentSelector = '[role="group"]';
const popoverInteractiveContentSelector = '[role="dialog"]';

describe('Popover', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ describe('PopoverSurface', () => {
expect(queryByRole('dialog')).not.toBeNull();
});

it('should set role complementary if focus trap is not active', () => {
it('should set role group if focus trap is not active', () => {
// Arrange
mockPopoverContext({ trapFocus: false });
const { getByTestId } = render(<PopoverSurface {...props}>Content</PopoverSurface>);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ exports[`PopoverSurface renders a default state 1`] = `
class="fui-PopoverSurface"
data-tabster="{\\"deloser\\":{},\\"modalizer\\":{\\"id\\":\\"modal-1\\",\\"isOthersAccessible\\":true}}"
data-testid="component"
role="complementary"
role="group"
>
Default PopoverSurface
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const usePopoverSurface_unstable = (
},
root: getNativeElementProps('div', {
ref: useMergedRefs(ref, contentRef),
role: trapFocus ? 'dialog' : 'complementary',
role: trapFocus ? 'dialog' : 'group',
'aria-modal': trapFocus ? true : undefined,
...modalAttributes,
...props,
Expand Down

0 comments on commit 177675f

Please sign in to comment.