Skip to content

Conversation

Manussakis
Copy link
Collaborator

@Manussakis Manussakis commented Nov 25, 2024

Submission Review Guidelines:

Changes proposed in this Pull Request:

Closes #51924 .

How to test the changes in this Pull Request:

Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions:

  1. Go to a product page.
  2. Scroll down to the tabs.
  3. When focus is on a tab item:
    • Verify that pressing the Tab/Shift+Tab key on the keyboard moves the focus away from the tab list.
    • Verify it's possible to navigate through the tab items by pressing the arrows left/right keys on the keyboard.
    • Verify that the focus moves to the first tab item when the Home key is pressed on the keyboard.
    • Verify that the focus moves to the last tab item when the End key is pressed on the keyboard.
  4. Turn on the screen reader.
  5. Verify screen reader announces the selected tab item and its position (e.g. 2 of 3).
  6. Verify it's possible to select a tab by pressing the Enter key on the keyboard.

Changelog entry

  • Automatically create a changelog entry from the details below.
  • This Pull Request does not require a changelog entry. (Comment required below)
Changelog Entry Details

Significance

  • Patch
  • Minor
  • Major

Type

  • Fix - Fixes an existing bug
  • Add - Adds functionality
  • Update - Update existing functionality
  • Dev - Development related task
  • Tweak - A minor adjustment to the codebase
  • Performance - Address performance issues
  • Enhancement - Improvement to existing functionality

Message

Changelog Entry Comment

Comment

@github-actions github-actions bot added plugin: woocommerce Issues related to the WooCommerce Core plugin. type: community contribution labels Nov 25, 2024
@woocommercebot woocommercebot requested review from a team, albarin, alexflorisca and kmanijak and removed request for a team November 25, 2024 20:51
Copy link
Contributor

Hi ,

Apart from reviewing the code changes, please make sure to review the testing instructions and verify that relevant tests (E2E, Unit, Integration, etc.) have been added or updated as needed.

You can follow this guide to find out what good testing instructions should look like:
https://github.com/woocommerce/woocommerce/wiki/Writing-high-quality-testing-instructions

@Manussakis Manussakis requested a review from dkotter November 27, 2024 02:13
@Manussakis
Copy link
Collaborator Author

@dkotter This PR is ready for code review.
Thanks!

Copy link
Contributor

@kmanijak kmanijak left a comment

Choose a reason for hiding this comment

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

@Manussakis, works as expected! Thanks you for working on it. Could you mark the PR ready for review and remove WIP from PR title? Unless there's something missing?

Once marked as ready for review I'm happy to approve and merge 🚀

@Manussakis
Copy link
Collaborator Author

@kmanijak Thanks for testing this PR!

Before removing it from the draft, let's wait for @dkotter and @qasumitbagthariya from 10up to review it too.

Thanks!

Copy link
Contributor

@dkotter dkotter left a comment

Choose a reason for hiding this comment

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

@ankitguptaindia @qasumitbagthariya This is ready for QA

@qasumitbagthariya
Copy link
Collaborator

QA/Test Report ✅


I have checked this PR in the Manussakis:fix/51924 branch and changes working as expected.

  • Verify that pressing the Tab/Shift+Tab key on the keyboard moves the focus away from the tab list. ✅
  • Verify it's possible to navigate through the tab items by pressing the arrows left/right keys on the keyboard. ✅
  • Verify that the focus moves to the first tab item when the Home key is pressed on the keyboard. ✅
  • Verify that the focus moves to the last tab item when the End key is pressed on the keyboard. ✅
  • Verify screen reader announces the selected tab item and its position (e.g. 2 of 3). ✅
Screen.Recording.2024-11-28.at.6.07.10.PM.mov

Testing Environment

  • WordPress: 6.7
  • Theme: Storefront 4.6.0
  • WooCommerce - WooCommerce - Dev version with this fix specific branch.
  • PHP: 8.0.30
  • Web Server: Nginx 1.20.2
  • Browser: Chrome
  • OS: macOS Ventura 13.3
  • Git Branch: Manussakis:fix/51924

@Manussakis Please remove [WIP] from the title and take this PR out of draft.

cc @vikrampm1

@Manussakis Manussakis marked this pull request as ready for review November 29, 2024 14:29
@Manussakis Manussakis changed the title [WIP][Accessible] Make tabs on product page accessible [Accessible] Make tabs on product page accessible Nov 29, 2024
@Manussakis
Copy link
Collaborator Author

@kmanijak This PR is ready to be merged.
Thanks!

Copy link
Contributor

@kmanijak kmanijak left a comment

Choose a reason for hiding this comment

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

Hi @Manussakis, thanks for the ping! I'm just not sure I understand one case you covered. Do you mind elaborating? 🙌

Comment on lines +76 to +90
.on( 'focusout', '.wc-tabs li a, ul.tabs li a, #respond p.stars a', function() {
setTimeout( function () {
var $activeElement = $( document.activeElement );
var sliderKeyupBlockers = [ '.stars', '.tabs', '.wc-tabs'];
var $closestBlocker = $activeElement.closest( sliderKeyupBlockers.join( ', ' ) );

if ( $closestBlocker.length ) {
// Prevent keyup events from being triggered on the flexslider when the focus is on the stars or tabs.
productGalleryElement.data('flexslider').animating = true;
return;
}

productGalleryElement.data('flexslider').animating = false;
}, 0);
} )
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you explain what case does it cover?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@kmanijak

This code fixes this issue that @qasumitbagthariya found on the #53018 PR.

The seTimeout function is necessary to ensure the correct active element is returned, otherwise, the body element is returned.

Please let me know if you have any questions.

Copy link
Contributor

Choose a reason for hiding this comment

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

👋 folks, it looks like that line 84 creates a regression: #57292

When the user clicks on the description and reviews tabs, the animation is set to true (and never reset) and this caused that this logic never runs and so the animation isn't triggered.

I'm going to see how we can fix it, but sharing in case you have a better idea to avoid setting animating to true.

Copy link
Contributor

@gigitux gigitux Apr 17, 2025

Choose a reason for hiding this comment

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

PR created: #57373

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@gigitux
According to my investigation, the issue is that when the focus is on the tab items (Description, Review,...), clicking on the slider, either on the thumbnails or on the active image, doesn't trigger the focusout event from the focused tab item, only if you click on any other element outside it.

Once the focus moves away from the tab, the slider works back.

Blocking the slider when the tab is active is intended, as this avoids the slides from moving when the user is using the keyboard to navigate through the tabs' content.

I am also investigating it and will keep you posted.

Thanks!

Copy link
Contributor

@kmanijak kmanijak left a comment

Choose a reason for hiding this comment

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

This code fixes this issue that @qasumitbagthariya found on the #53018 PR.
The seTimeout function is necessary to ensure the correct active element is returned, otherwise, the body element is returned.
Please let me know if you have any questions.

Appreciate the explanation! LGTM, thank you!

@kmanijak kmanijak merged commit 3765a66 into woocommerce:trunk Dec 2, 2024
38 of 41 checks passed
@github-actions github-actions bot added this to the 9.6.0 milestone Dec 2, 2024
@github-actions github-actions bot added the needs: analysis Indicates if the PR requires a PR testing scrub session. label Dec 2, 2024
@Stojdza Stojdza added status: analysis complete Indicates if a PR has been analysed by Solaris and removed needs: analysis Indicates if the PR requires a PR testing scrub session. labels Dec 3, 2024
@louwie17
Copy link
Contributor

Just a note that this PR caused a regression on product pages that aren't displaying a product gallery ( for example if a product has a single image ). See this error:
Screenshot 2024-12-19 at 10 29 07 AM

@louwie17
Copy link
Contributor

I end up working on a fix here: #53877
Given it needs a code freeze exception for the 9.6 release.

PavloBorysenko pushed a commit to PavloBorysenko/woocommerce that referenced this pull request Jan 3, 2025
* Add aria attributes to tab link on product page

* Make product tabs keyboard accessible

* Add changelog file

* Fix tab focus style on TT1 theme

* Bump tabs template version

* Prevent keyup events from being triggered on the flexslider when the focus is on the stars or tabs.

* Update test to match the new tab role

* Fix slider when clicking on the thumbnail with focus on tab or stars

---------

Co-authored-by: Karol Manijak <[email protected]>
@gigitux
Copy link
Contributor

gigitux commented Mar 4, 2025

👋 Hey folks, I just came across this issue. According to the Lighthouse report, it seems this PR lowers the accessibility score of the Single Product Page.

@Manussakis is it something that you can investigate?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin: woocommerce Issues related to the WooCommerce Core plugin. status: analysis complete Indicates if a PR has been analysed by Solaris type: community contribution
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Accessibility: Invalid/Incorrect ARIA roles - links nested within tabs
7 participants