Skip to content
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(ThumbnailsSidebar): A11Y - add aria-current to ThumbnailsSidebar #1417

Merged

Conversation

fsuarez-globant
Copy link
Contributor

There is a visual indication of the current thumbnail that also presents the current page You should convey this information to screen reader with aria-current="true". For example:

Screen Shot 2021-08-05 at 2 56 06 PM

@fsuarez-globant fsuarez-globant requested a review from a team as a code owner August 5, 2021 19:57
@@ -254,6 +254,7 @@ class ThumbnailsSidebar {

if (pageNum === this.currentPage) {
thumbnailEl.classList.add(CLASS_BOX_PREVIEW_THUMBNAIL_IS_SELECTED);
thumbnailEl.setAttribute('aria-current', true);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this value get updated as the user changes between pages?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jstoffan you are right. I added and removed the aria-current when user changes between pages.

Copy link
Collaborator

@jstoffan jstoffan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add tests, please?

@fsuarez-globant
Copy link
Contributor Author

@jstoffan I just added an unit test


thumbnailsSidebar.applyCurrentPageSelection();

expect(stubs.addAriaAttribute).toBeCalledTimes(1);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add an assertion for the removeAttribute call, as well, similar to the tests above?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jstoffan I just added another unit test case.

@jstoffan jstoffan merged commit 75ede5e into box:master Aug 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants