Skip to content

Commit

Permalink
feat(select): improve accessibility
Browse files Browse the repository at this point in the history
  • Loading branch information
Enlcxx committed Sep 14, 2020
1 parent 98b3139 commit 57ad543
Show file tree
Hide file tree
Showing 3 changed files with 690 additions and 220 deletions.
18 changes: 18 additions & 0 deletions src/lib/select/select-errors.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/**
* Returns an exception to be thrown when attempting to assign a non-array value to a select
* in `multiple` mode. Note that `undefined` and `null` are still valid values to allow for
* resetting the value.
* @docs-private
*/
export function getLySelectNonArrayValueError(): Error {
return Error('Value must be an array in multiple-selection mode.');
}

/**
* Returns an exception to be thrown when assigning a non-function value to the comparator
* used to determine if a value corresponds to an option. Note that whether the function
* actually takes two values and returns a boolean is not checked.
*/
export function getLySelectNonFunctionValueError(): Error {
return Error('`compareWith` must be a function.');
}
11 changes: 10 additions & 1 deletion src/lib/select/select.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,16 @@
</div>

<ng-template #templateRef>
<div #container [className]="classes.container" [@selectEnter]="'in'" (@selectLeave.done)="_endAnimation($event)">
<div
#container
tabindex="-1"
role="listbox"
[className]="classes.container"
[@selectEnter]="'in'"
(@selectEnter.done)="_panelDoneAnimatingStream.next($event.toState)"
(keydown)="_handleKeydown($event)"
[style.font-size.px]="_triggerFontSize"
>
<ng-content></ng-content>
</div>
</ng-template>
Loading

0 comments on commit 57ad543

Please sign in to comment.