fix: docsearch input should have aria-label (a11y) (#687)
* fix: search input a11y issue * fix: docsearch input should have aria-label (a11y) * update test
This commit is contained in:
parent
c0e9e19b9f
commit
59d21f5e19
2 changed files with 5 additions and 1 deletions
|
|
@ -80,7 +80,9 @@ class DocSearch {
|
|||
this.autocompleteOptions.cssClasses || {};
|
||||
this.autocompleteOptions.cssClasses.prefix =
|
||||
this.autocompleteOptions.cssClasses.prefix || 'ds';
|
||||
|
||||
const inputAriaLabel = this.input && typeof this.input.attr === 'function' && this.input.attr('aria-label');
|
||||
this.autocompleteOptions.ariaLabel =
|
||||
this.autocompleteOptions.ariaLabel || inputAriaLabel || "search input";
|
||||
|
||||
this.isSimpleLayout = layout === 'simple';
|
||||
|
||||
|
|
|
|||
|
|
@ -175,6 +175,7 @@ describe('DocSearch', () => {
|
|||
debug: false,
|
||||
cssClasses: { prefix: 'ds' },
|
||||
anOption: 44,
|
||||
ariaLabel: 'search input',
|
||||
});
|
||||
});
|
||||
it('should instantiate algoliasearch with the correct values', () => {
|
||||
|
|
@ -217,6 +218,7 @@ describe('DocSearch', () => {
|
|||
anOption: '44',
|
||||
cssClasses: { prefix: 'ds' },
|
||||
debug: false,
|
||||
ariaLabel: 'search input'
|
||||
})
|
||||
).toBe(true);
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue