-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(expansion-panel): implement keyboard controls (#12427)
Based on the [accessibility guidelines](https://www.w3.org/TR/wai-aria-practices-1.1/#accordion), accordions should be able to support moving focus using the keyboard. These changes implement the keyboard support and move some things around to avoid circular imports.
- Loading branch information
Showing
6 changed files
with
237 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/** | ||
* @license | ||
* Copyright Google LLC All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
|
||
import {InjectionToken} from '@angular/core'; | ||
import {CdkAccordion} from '@angular/cdk/accordion'; | ||
|
||
/** MatAccordion's display modes. */ | ||
export type MatAccordionDisplayMode = 'default' | 'flat'; | ||
|
||
/** | ||
* Base interface for a `MatAccordion`. | ||
* @docs-private | ||
*/ | ||
export interface MatAccordionBase extends CdkAccordion { | ||
/** Whether the expansion indicator should be hidden. */ | ||
hideToggle: boolean; | ||
|
||
/** Display mode used for all expansion panels in the accordion. */ | ||
displayMode: MatAccordionDisplayMode; | ||
|
||
/** Handles keyboard events coming in from the panel headers. */ | ||
_handleHeaderKeydown: (event: KeyboardEvent) => void; | ||
|
||
/** Handles focus events on the panel headers. */ | ||
_handleHeaderFocus: (header: any) => void; | ||
} | ||
|
||
|
||
/** | ||
* Token used to provide a `MatAccordion` to `MatExpansionPanel`. | ||
* Used primarily to avoid circular imports between `MatAccordion` and `MatExpansionPanel`. | ||
*/ | ||
export const MAT_ACCORDION = new InjectionToken<MatAccordionBase>('MAT_ACCORDION'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.