Skip to content

Commit f83cdcf

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

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
@@ -73,7 +73,7 @@ export const EXPANSION_PANEL_ANIMATION_TIMING = '225ms cubic-bezier(0.4,0.0,0.2,
7373
})
7474
export class MdExpansionPanel extends AccordionItem implements OnChanges, OnDestroy {
7575
/** Whether the toggle indicator should be hidden. */
76-
@Input() hideToggle: boolean = false;
76+
@Input() hideToggle: string = 'end';
7777

7878
/** Stream that emits for changes in `@Input` properties. */
7979
_inputChanges = new Subject<SimpleChanges>();
@@ -86,11 +86,11 @@ export class MdExpansionPanel extends AccordionItem implements OnChanges, OnDest
8686
}
8787

8888
/** Whether the expansion indicator should be hidden. */
89-
_getHideToggle(): boolean {
89+
_getHideToggle(): string {
9090
if (this.accordion) {
91-
return this.accordion.hideToggle;
91+
return this.accordion.hideToggle ? '' : 'hidden';
9292
}
93-
return this.hideToggle;
93+
return this.hideToggle ? '' : 'hidden';
9494
}
9595

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

0 commit comments

Comments
 (0)