question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Typeahead: accessibility issues

See original GitHub issue

Bug description:

Typeahead component has accessibility issues. Code written in the html file:

<input id="typeahead" type="text" class="form-control" [(ngModel)]="model" [ngbTypeahead]="search" />

Code evaluated in the html markup ( from browsers debug console):

<input _ngcontent-c4="" aria-multiline="false" autocapitalize="off" autocorrect="off" class="form-control ng-untouched ng-pristine ng-valid" id="typeahead" role="combobox" type="text" ng-reflect-ngb-typeahead="function (text$) {="off" aria-autocomplete="list" aria-expanded="false">

The HTML markup gives it role="combobox" and a property of aria-multiline="false".

However, according to https://www.w3.org/TR/wai-aria-1.1/#combobox, combobox has no arrtibute of type ‘aria-multiline’ because of which it is failing the axe accessibility test saying that the aria attribute is not allowed.

Link to minimally-working StackBlitz that reproduces the issue:

https://stackblitz.com/angular/dnbxerkrvpap?file=app%2Ftypeahead-basic.html

(check the markup generated by the browser)

Versions of Angular, ng-bootstrap and Bootstrap:

Angular CLI: 7.0.6:

ng-bootstrap: 3.3.1

Bootstrap:4.1.1

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:5
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
aleMaquedacommented, Feb 7, 2019

Try removing the attribute :

<input type="text" class="form-control" #mainSearch
  [(ngModel)]="currentSearch"  
  [ngbTypeahead]="autocomplete" placeholder="" 
  [resultFormatter]="resultFormatter"
  [inputFormatter]="inputFormatter"
  (selectItem)="selectSuggestion($event)">
@ViewChild('mainSearch') searchInputText: ElementRef;
 constructor(private renderer: Renderer2) {}

 ngAfterViewInit(): void {
     if (this.searchInputText !== undefined ) {
         this.renderer.removeAttribute(this.searchInputText.nativeElement, 'aria-multiline');
     }
 }
1reaction
DutchKevvcommented, Dec 18, 2020

Is this gonna be fixed? It doesn’t seem like a huge change

Read more comments on GitHub >

github_iconTop Results From Across the Web

Guidelines for the accessibility of an autocompletion component
Autocomplete components are increasingly common in user interfaces, yet they often remain inaccessible. We therefore decided to carry out an ...
Read more >
Accessible Autocomplete
View the full library of accessibility solutions. This is an accessible autocomplete which works with keyboard, screen readers, switch devices, and touch ...
Read more >
Issues for Accessible Autocomplete | Drupal.org
Title Status Priority Category Allow for an empty seach Needs review Normal Feature request "exports" in package.json should be relative path Closed (fixed) Normal Bug...
Read more >
What we learned from getting our autocomplete tested for ...
This isn't specifically an accessibility issue but it is a potential usability one. Becs – mobility impaired. Becs uses Dragon NaturallySpeaking ...
Read more >
Autocomplete attribute must be used correctly | Axe Rules
Start building more accessible experiences. Axe DevTools Pro helps dev teams find and fix up to 80% of accessibility issues while coding ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found