Skip to content

Commit ff02aa8

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

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
@@ -27,10 +27,16 @@ <h1>Accordion</h1>
2727
<p>Accordion Options</p>
2828
<div>
2929
<mat-slide-toggle [(ngModel)]="multi">Allow Multi Expansion</mat-slide-toggle>
30-
<mat-slide-toggle [(ngModel)]="hideToggle">Hide Indicators</mat-slide-toggle>
3130
<mat-slide-toggle [(ngModel)]="disabled">Disable Panel 2</mat-slide-toggle>
3231
<mat-slide-toggle [(ngModel)]="showPanel3">Show Panel 3</mat-slide-toggle>
3332
</div>
33+
<div>
34+
<mat-radio-group [(ngModel)]="hideToggle">
35+
<mat-radio-button value="start">Start</mat-radio-button>
36+
<mat-radio-button value="end">End</mat-radio-button>
37+
<mat-radio-button value="hidden">Hidden</mat-radio-button>
38+
</mat-radio-group>
39+
</div>
3440
<p>Accordion Style</p>
3541
<mat-radio-group [(ngModel)]="displayMode">
3642
<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
@@ -32,9 +32,7 @@ export class CdkAccordion {
3232
private _multi: boolean = false;
3333

3434
/** Whether the expansion indicator should be hidden. */
35-
@Input() get hideToggle(): boolean { return this._hideToggle; }
36-
set hideToggle(show: boolean) { this._hideToggle = coerceBooleanProperty(show); }
37-
private _hideToggle: boolean = false;
35+
@Input() hideToggle = 'end';
3836

3937
/**
4038
* 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
@@ -82,7 +82,7 @@ export const EXPANSION_PANEL_ANIMATION_TIMING = '225ms cubic-bezier(0.4,0.0,0.2,
8282
export class MatExpansionPanel extends _MatExpansionPanelMixinBase
8383
implements CanDisable, OnChanges, OnDestroy {
8484
/** Whether the toggle indicator should be hidden. */
85-
@Input() hideToggle: boolean = false;
85+
@Input() hideToggle: string = 'end';
8686

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

9797
/** Whether the expansion indicator should be hidden. */
98-
_getHideToggle(): boolean {
98+
_getHideToggle(): string {
9999
if (this.accordion) {
100-
return this.accordion.hideToggle;
100+
return this.accordion.hideToggle ? '' : 'hidden';
101101
}
102-
return this.hideToggle;
102+
return this.hideToggle ? '' : 'hidden';
103103
}
104104

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

0 commit comments

Comments
 (0)