Unverified Commit 857cde8e authored by Kyle Keating's avatar Kyle Keating Committed by GitHub

Merge pull request #1779 from hypothesis/a11y-tag-editor-fix

Fix AutocompleteList aria-selecterd prop
parents 954286d7 661488dc
......@@ -34,7 +34,7 @@ export default function AutocompleteList({
<li
key={`autocomplete-list-${index}`}
role="option"
aria-selected={activeItem === index}
aria-selected={(activeItem === index).toString()}
className={classnames(
{
'is-selected': activeItem === index,
......
......@@ -146,19 +146,22 @@ describe('AutocompleteList', function() {
);
});
it('sets the `aria-selected` attribute on the active index ', () => {
it('sets the `aria-selected` attribute to "true" on the active item and "false" for all others', () => {
const wrapper = createComponent({ open: true, activeItem: 0 });
assert.isTrue(
assert.equal(
wrapper
.find('li')
.at(0)
.prop('aria-selected')
.prop('aria-selected'),
'true'
);
assert.isFalse(
assert.equal(
wrapper
.find('li')
.at(1)
.prop('aria-selected')
.prop('aria-selected'),
'false'
);
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment