Skip to content

Commit 1de43c3

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

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
<md-slide-toggle [(ngModel)]="multi">Allow Multi Expansion</md-slide-toggle>
30-
<md-slide-toggle [(ngModel)]="hideToggle">Hide Indicators</md-slide-toggle>
3130
<md-slide-toggle [(ngModel)]="disabled">Disable Panel 2</md-slide-toggle>
3231
<md-slide-toggle [(ngModel)]="showPanel3">Show Panel 3</md-slide-toggle>
3332
</div>
33+
<div>
34+
<md-radio-group [(ngModel)]="hideToggle">
35+
<md-radio-button value="start">Start</md-radio-button>
36+
<md-radio-button value="end">End</md-radio-button>
37+
<md-radio-button value="hidden">Hidden</md-radio-button>
38+
</md-radio-group>
39+
</div>
3440
<p>Accordion Style</p>
3541
<md-radio-group [(ngModel)]="displayMode">
3642
<md-radio-button value="default">Default</md-radio-button>

src/lib/expansion/accordion.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@ export class CdkAccordion {
3131
private _multi: boolean = false;
3232

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

3836
/**
3937
* 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="md-panel-description, 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
@@ -137,8 +137,11 @@ export class MdExpansionPanelHeader implements OnDestroy {
137137
}
138138

139139
/** Gets whether the expand indicator should be shown. */
140-
_showToggle(): boolean {
141-
return !this.panel.hideToggle && !this.panel.disabled;
140+
_indicatorLocation(): string {
141+
if (this.panel.disabled) {
142+
return 'hidden';
143+
}
144+
return this.panel.hideToggle;
142145
}
143146

144147
/** 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
@@ -79,7 +79,7 @@ export const EXPANSION_PANEL_ANIMATION_TIMING = '225ms cubic-bezier(0.4,0.0,0.2,
7979
export class MdExpansionPanel extends _MdExpansionPanelMixinBase
8080
implements CanDisable, OnChanges, OnDestroy {
8181
/** Whether the toggle indicator should be hidden. */
82-
@Input() hideToggle: boolean = false;
82+
@Input() hideToggle: string = 'end';
8383

8484
/** Stream that emits for changes in `@Input` properties. */
8585
_inputChanges = new Subject<SimpleChanges>();
@@ -92,11 +92,11 @@ export class MdExpansionPanel extends _MdExpansionPanelMixinBase
9292
}
9393

9494
/** Whether the expansion indicator should be hidden. */
95-
_getHideToggle(): boolean {
95+
_getHideToggle(): string {
9696
if (this.accordion) {
97-
return this.accordion.hideToggle;
97+
return this.accordion.hideToggle ? '' : 'hidden';
9898
}
99-
return this.hideToggle;
99+
return this.hideToggle ? '' : 'hidden';
100100
}
101101

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

0 commit comments

Comments
 (0)