Skip to content

Commit 8c3d791

Browse files
committed
fix(material/bottom-sheet): aria-modal not being set
Fixes that `aria-modal` wasn't being set on the bottom sheet container. This likely broke when the bottom sheet was refactored to use the CDK dialog. (cherry picked from commit 90e6446)
1 parent 7d314a8 commit 8c3d791

File tree

4 files changed

+6
-1
lines changed

4 files changed

+6
-1
lines changed

src/material/bottom-sheet/bottom-sheet-config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ export class MatBottomSheetConfig<D = any> {
4444
/** Aria label to assign to the bottom sheet element. */
4545
ariaLabel?: string | null = null;
4646

47+
/** Whether this is a modal bottom sheet. Used to set the `aria-modal` attribute. */
48+
ariaModal?: boolean = true;
49+
4750
/**
4851
* Whether the bottom sheet should close when the user goes backwards/forwards in history.
4952
* Note that this usually doesn't include clicking on links (unless the user is using

src/material/bottom-sheet/bottom-sheet-container.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ import {matBottomSheetAnimations} from './bottom-sheet-animations';
4747
'class': 'mat-bottom-sheet-container',
4848
'tabindex': '-1',
4949
'[attr.role]': '_config.role',
50-
'[attr.aria-modal]': '_config.isModal',
50+
'[attr.aria-modal]': '_config.ariaModal',
5151
'[attr.aria-label]': '_config.ariaLabel',
5252
'[@state]': '_animationState',
5353
'(@state.start)': '_onAnimationStart($event)',

src/material/bottom-sheet/bottom-sheet.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ describe('MatBottomSheet', () => {
156156

157157
const containerElement = overlayContainerElement.querySelector('mat-bottom-sheet-container')!;
158158
expect(containerElement.getAttribute('role')).toBe('dialog');
159+
expect(containerElement.getAttribute('aria-modal')).toBe('true');
159160
});
160161

161162
it('should close a bottom sheet via the escape key', fakeAsync(() => {

tools/public_api_guard/material/bottom-sheet.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ export const matBottomSheetAnimations: {
6666
// @public
6767
export class MatBottomSheetConfig<D = any> {
6868
ariaLabel?: string | null;
69+
ariaModal?: boolean;
6970
autoFocus?: AutoFocusTarget | string | boolean;
7071
backdropClass?: string;
7172
closeOnNavigation?: boolean;

0 commit comments

Comments
 (0)