New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Inserter Search Results Not Announcing #10755

Merged
merged 3 commits into from Oct 23, 2018

Conversation

Projects
None yet
3 participants
@LukePettway
Contributor

LukePettway commented Oct 18, 2018

Description

The inserter search results do not announce to screen readers the current number of filtered results. This implements some logic to calculate that number and announce to the user how many results have been found.

How has this been tested?

First and foremost, I typed in various strings of text to change the number of results. Then I made sure the text in the live region calculated the correct number and matched up with the actual count.

Then I used VoiceOver and Safari (there is a bug in other browsers where aria-live doesn't work) to test that the value of the aria-live region is read to a screen reader. At least from my initial testing everything seemed to work correctly.

Screenshots

screen shot 2018-10-18 at 3 58 31 pm

screen shot 2018-10-18 at 3 59 26 pm

screen shot 2018-10-18 at 3 59 16 pm

screen shot 2018-10-18 at 3 59 22 pm

screen shot 2018-10-18 at 3 58 04 pm

Types of changes

Makes the inserter more accessible by fixing this issue: #10583

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.

@Soean Soean added the Accessibility label Oct 18, 2018

@tofumatt tofumatt self-requested a review Oct 23, 2018

@tofumatt tofumatt added this to the 4.2 milestone Oct 23, 2018

@tofumatt

Awesome, thanks so much.

Tested this in Windows with Firefox + NVDA as well and it worked a treat. 👍

@@ -205,6 +205,15 @@ export class InserterMenu extends Component {
itemsPerCategory,
openPanels,
} );
const resultCount = Object.keys( itemsPerCategory ).reduce( ( memo, curr ) => memo + itemsPerCategory[ curr ].length, 0 );

This comment has been minimized.

@tofumatt

tofumatt Oct 23, 2018

Member

I'll fix this, but for future reference: please use full words for variables whenever possible. It's easier to read current than curr. I assume this should be current, right? 😄

This comment has been minimized.

@LukePettway

LukePettway Oct 23, 2018

Contributor

Thanks @tofumatt, I'll make sure to read over the documentation to make sure I follow the standards going forward! 👍

tofumatt added some commits Oct 23, 2018

@tofumatt tofumatt merged commit 9a80b98 into WordPress:master Oct 23, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

antpb added a commit to antpb/gutenberg that referenced this pull request Oct 26, 2018

Fix: Inserter Search Results Not Announcing (WordPress#10755)
* added functionality to get the result count and announcer it in the live region

* chore: Tweak variable names/readability

* Sort props
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment