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

fix: update non-focus-trap Popover role to be group #24897

Merged
merged 3 commits into from
Sep 26, 2022
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
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