Skip to content

Commit

Permalink
docs(a11y): add accessibility sections to datepicker, menu, slide … (a…
Browse files Browse the repository at this point in the history
  • Loading branch information
tinayuangao authored and josephperrott committed Oct 12, 2017
1 parent 70c349c commit 42342d6
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 11 deletions.
8 changes: 7 additions & 1 deletion src/demo-app/expansion/expansion-demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,16 @@ <h1>matAccordion</h1>
<p>Accordion Options</p>
<div>
<mat-slide-toggle [(ngModel)]="multi">Allow Multi Expansion</mat-slide-toggle>
<mat-slide-toggle [(ngModel)]="hideToggle">Hide Indicators</mat-slide-toggle>
<mat-slide-toggle [(ngModel)]="disabled">Disable Panel 2</mat-slide-toggle>
<mat-slide-toggle [(ngModel)]="showPanel3">Show Panel 3</mat-slide-toggle>
</div>
<div>
<mat-radio-group [(ngModel)]="hideToggle">
<mat-radio-button value="start">Start</mat-radio-button>
<mat-radio-button value="end">End</mat-radio-button>
<mat-radio-button value="hidden">Hidden</mat-radio-button>
</mat-radio-group>
</div>
<p>Accordion Style</p>
<mat-radio-group [(ngModel)]="displayMode">
<mat-radio-button value="default">Default</mat-radio-button>
Expand Down
4 changes: 1 addition & 3 deletions src/lib/expansion/accordion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ export type MatAccordionDisplayMode = 'default' | 'flat';
})
export class MatAccordion extends _CdkAccordion {
/** Whether the expansion indicator should be hidden. */
@Input() get hideToggle(): boolean { return this._hideToggle; }
set hideToggle(show: boolean) { this._hideToggle = coerceBooleanProperty(show); }
private _hideToggle: boolean = false;
@Input() hideToggle = 'end';

/**
* The display mode used for all expansion panels in the accordion. Currently two display
Expand Down
2 changes: 1 addition & 1 deletion src/lib/expansion/expansion-panel-header.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
<ng-content select="mat-panel-description"></ng-content>
<ng-content></ng-content>
</span>
<span [@indicatorRotate]="_getExpandedState()" *ngIf="_showToggle()"
<span [@indicatorRotate]="_getExpandedState()" *ngIf="_indicatorLocation() !== 'hidden'"
class="mat-expansion-indicator"></span>
7 changes: 5 additions & 2 deletions src/lib/expansion/expansion-panel-header.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,11 @@ export class MatExpansionPanelHeader implements OnDestroy {
}

/** Gets whether the expand indicator should be shown. */
_showToggle(): boolean {
return !this.panel.hideToggle && !this.panel.disabled;
_indicatorLocation(): string {
if (this.panel.disabled) {
return 'hidden';
}
return this.panel.hideToggle;
}

/** Handle keyup event calling to toggle() if appropriate. */
Expand Down
8 changes: 4 additions & 4 deletions src/lib/expansion/expansion-panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export const EXPANSION_PANEL_ANIMATION_TIMING = '225ms cubic-bezier(0.4,0.0,0.2,
export class MatExpansionPanel extends _MatExpansionPanelMixinBase
implements CanDisable, OnChanges, OnDestroy {
/** Whether the toggle indicator should be hidden. */
@Input() hideToggle: boolean = false;
@Input() hideToggle: string = 'end';

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

/** Whether the expansion indicator should be hidden. */
_getHideToggle(): boolean {
_getHideToggle(): string {
if (this.accordion) {
return this.accordion.hideToggle;
return this.accordion.hideToggle ? '' : 'hidden';
}
return this.hideToggle;
return this.hideToggle ? '' : 'hidden';
}

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

0 comments on commit 42342d6

Please sign in to comment.