Skip to content

Commit 42342d6

Browse files
tinayuangaojosephperrott
authored andcommitted
docs(a11y): add accessibility sections to datepicker, menu, slide … (angular#6710)
1 parent 70c349c commit 42342d6

File tree

5 files changed

+18
-11
lines changed

5 files changed

+18
-11
lines changed

src/demo-app/expansion/expansion-demo.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,16 @@ <h1>matAccordion</h1>
3030
<p>Accordion Options</p>
3131
<div>
3232
<mat-slide-toggle [(ngModel)]="multi">Allow Multi Expansion</mat-slide-toggle>
33-
<mat-slide-toggle [(ngModel)]="hideToggle">Hide Indicators</mat-slide-toggle>
3433
<mat-slide-toggle [(ngModel)]="disabled">Disable Panel 2</mat-slide-toggle>
3534
<mat-slide-toggle [(ngModel)]="showPanel3">Show Panel 3</mat-slide-toggle>
3635
</div>
36+
<div>
37+
<mat-radio-group [(ngModel)]="hideToggle">
38+
<mat-radio-button value="start">Start</mat-radio-button>
39+
<mat-radio-button value="end">End</mat-radio-button>
40+
<mat-radio-button value="hidden">Hidden</mat-radio-button>
41+
</mat-radio-group>
42+
</div>
3743
<p>Accordion Style</p>
3844
<mat-radio-group [(ngModel)]="displayMode">
3945
<mat-radio-button value="default">Default</mat-radio-button>

src/lib/expansion/accordion.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@ export type MatAccordionDisplayMode = 'default' | 'flat';
2828
})
2929
export class MatAccordion extends _CdkAccordion {
3030
/** Whether the expansion indicator should be hidden. */
31-
@Input() get hideToggle(): boolean { return this._hideToggle; }
32-
set hideToggle(show: boolean) { this._hideToggle = coerceBooleanProperty(show); }
33-
private _hideToggle: boolean = false;
31+
@Input() hideToggle = 'end';
3432

3533
/**
3634
* The display mode used for all expansion panels in the accordion. Currently two display

src/lib/expansion/expansion-panel-header.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
<ng-content select="mat-panel-description"></ng-content>
44
<ng-content></ng-content>
55
</span>
6-
<span [@indicatorRotate]="_getExpandedState()" *ngIf="_showToggle()"
6+
<span [@indicatorRotate]="_getExpandedState()" *ngIf="_indicatorLocation() !== 'hidden'"
77
class="mat-expansion-indicator"></span>

src/lib/expansion/expansion-panel-header.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,11 @@ export class MatExpansionPanelHeader implements OnDestroy {
132132
}
133133

134134
/** Gets whether the expand indicator should be shown. */
135-
_showToggle(): boolean {
136-
return !this.panel.hideToggle && !this.panel.disabled;
135+
_indicatorLocation(): string {
136+
if (this.panel.disabled) {
137+
return 'hidden';
138+
}
139+
return this.panel.hideToggle;
137140
}
138141

139142
/** Handle keyup event calling to toggle() if appropriate. */

src/lib/expansion/expansion-panel.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export const EXPANSION_PANEL_ANIMATION_TIMING = '225ms cubic-bezier(0.4,0.0,0.2,
9191
export class MatExpansionPanel extends _MatExpansionPanelMixinBase
9292
implements CanDisable, OnChanges, OnDestroy {
9393
/** Whether the toggle indicator should be hidden. */
94-
@Input() hideToggle: boolean = false;
94+
@Input() hideToggle: string = 'end';
9595

9696
/** Stream that emits for changes in `@Input` properties. */
9797
_inputChanges = new Subject<SimpleChanges>();
@@ -107,11 +107,11 @@ export class MatExpansionPanel extends _MatExpansionPanelMixinBase
107107
}
108108

109109
/** Whether the expansion indicator should be hidden. */
110-
_getHideToggle(): boolean {
110+
_getHideToggle(): string {
111111
if (this.accordion) {
112-
return this.accordion.hideToggle;
112+
return this.accordion.hideToggle ? '' : 'hidden';
113113
}
114-
return this.hideToggle;
114+
return this.hideToggle ? '' : 'hidden';
115115
}
116116

117117
/** Determines whether the expansion panel should have spacing between it and its siblings. */

0 commit comments

Comments
 (0)