Skip to content
Permalink
Browse files
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)
  • Loading branch information
crisbeto committed Sep 26, 2022
1 parent 7d314a8 commit 8c3d791562e28902aded5c4e73b2337b74452ebc
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 1 deletion.
@@ -44,6 +44,9 @@ export class MatBottomSheetConfig<D = any> {
/** Aria label to assign to the bottom sheet element. */
ariaLabel?: string | null = null;

/** Whether this is a modal bottom sheet. Used to set the `aria-modal` attribute. */
ariaModal?: boolean = true;

/**
* Whether the bottom sheet should close when the user goes backwards/forwards in history.
* Note that this usually doesn't include clicking on links (unless the user is using
@@ -47,7 +47,7 @@ import {matBottomSheetAnimations} from './bottom-sheet-animations';
'class': 'mat-bottom-sheet-container',
'tabindex': '-1',
'[attr.role]': '_config.role',
'[attr.aria-modal]': '_config.isModal',
'[attr.aria-modal]': '_config.ariaModal',
'[attr.aria-label]': '_config.ariaLabel',
'[@state]': '_animationState',
'(@state.start)': '_onAnimationStart($event)',
@@ -156,6 +156,7 @@ describe('MatBottomSheet', () => {

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

it('should close a bottom sheet via the escape key', fakeAsync(() => {
@@ -66,6 +66,7 @@ export const matBottomSheetAnimations: {
// @public
export class MatBottomSheetConfig<D = any> {
ariaLabel?: string | null;
ariaModal?: boolean;
autoFocus?: AutoFocusTarget | string | boolean;
backdropClass?: string;
closeOnNavigation?: boolean;

0 comments on commit 8c3d791

Please sign in to comment.