Skip to content

Commit 020a017

Browse files
authored
Merge pull request #177 from cal-smith/a11y
Fix DAP issues for combobox and dropdown
2 parents 7da7587 + ea3bc0b commit 020a017

File tree

3 files changed

+9
-11
lines changed

3 files changed

+9
-11
lines changed

src/combobox/combobox.component.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,11 @@ import { NG_VALUE_ACCESSOR } from "@angular/forms";
6161
</div>
6262
<input
6363
[disabled]="disabled"
64-
[attr.aria-expanded]="open"
6564
(click)="toggleDropdown()"
6665
(keyup)="onSearch($event.target.value)"
6766
[value]="selectedValue"
6867
class="bx--text-input"
6968
aria-label="ListBox input field"
70-
role="combobox"
71-
aria-autocomplete="list"
7269
autocomplete="off"
7370
placeholder="Filter..."/>
7471
<div
@@ -200,7 +197,7 @@ export class ComboBox implements OnChanges, OnInit, AfterViewInit, AfterContentI
200197
@ContentChild(AbstractDropdownView) view: AbstractDropdownView;
201198
@ViewChild("dropdownMenu") dropdownMenu;
202199
@HostBinding("class") class = "bx--combo-box bx--list-box";
203-
@HostBinding("attr.role") role = "listbox";
200+
@HostBinding("attr.role") role = "combobox";
204201
@HostBinding("style.display") display = "block";
205202

206203
public open = false;

src/dropdown/dropdown.component.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,16 @@ import {
44
Output,
55
EventEmitter,
66
ElementRef,
7-
ViewEncapsulation,
87
ContentChild,
98
OnInit,
109
ViewChild,
1110
AfterContentInit,
12-
AfterViewInit,
1311
HostListener,
14-
forwardRef,
15-
OnDestroy,
16-
HostBinding
12+
OnDestroy
1713
} from "@angular/core";
1814
import { NG_VALUE_ACCESSOR } from "@angular/forms";
1915

16+
// Observable import is required here so typescript can compile correctly
2017
import { Observable, fromEvent, of, Subscription } from "rxjs";
2118
import { throttleTime } from "rxjs/operators";
2219

src/dropdown/list/dropdown-list.component.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,10 @@ import { ScrollableList } from "./../scrollable-list.directive";
5353
@Component({
5454
selector: "ibm-dropdown-list",
5555
template: `
56-
<ul #list class="bx--list-box__menu">
56+
<ul
57+
#list
58+
role="listbox"
59+
class="bx--list-box__menu">
5760
<li tabindex="{{item.disabled? -1 : 0}}"
5861
role="option"
5962
*ngFor="let item of displayItems"
@@ -72,7 +75,8 @@ import { ScrollableList } from "./../scrollable-list.directive";
7275
type="checkbox"
7376
[checked]="item.selected"
7477
[disabled]="item.disabled"
75-
(click)="doClick($event, item)">
78+
(click)="doClick($event, item)"
79+
tabindex="-1">
7680
<label class="bx--checkbox-label">{{item.content}}</label>
7781
</div>
7882
<ng-container *ngIf="!listTpl && type === 'single'">{{item.content}}</ng-container>

0 commit comments

Comments
 (0)