Page MenuHomePhabricator

Improve keyboard navigation
Closed, ResolvedPublic3 Estimated Story Points

Description

Initially submitted by @Etonkovidova in: T402872#11153884:

(1) Test case 1: Navigating with Tab
(1.2) Clicking Tab to navigate to the the gallery makes the whole element become selected. After that clicking on Enter or spacebar do not have any effect. Another Tab click will select the first image. The issue is present only on FF (Firefox 141 was tested)

Screenshot 2025-09-05 at 3.07.52 PM.png (2,312×808 px, 1 MB)

Focus should immediately go to the first thumbnail

(2) Test case 2: Focusing on elements
(2.2) There are unreachable controls/options Share/Copy

Screenshot 2025-09-05 at 5.52.14 PM.png (958×698 px, 776 KB)
Screenshot 2025-09-05 at 5.52.57 PM.png (856×506 px, 420 KB)

Popover controls should also be focusable right after they've been opened

(2.3) Clicking on x button (to return to the article page) results in lost focus

I'm unsure whether focus should return to the original image that was used to open the overlay, or to the last one that was visible in detail (in case another image was selected in VTOC); up to whoever implements this to think this through :)

Other potential improvements
We may want to improve the keyboard navigation of the Carousel component so that left and right keyboard arrows can be used to move between carousel items. Relatedly, we could update behavior of this component so that focus is always received on a specific image within the carousel (as opposed to the carousel as a whole) – this might provide a more intuitive user experience. Both of these behaviors are implemented by the Codex Tabs component (and the OOUI tab widget before that), so it should be easy to port over some relevant Vue code.


Requirement

Ensure complete keyboard accessibility for the Image Browsing carousel and overlay in the Minerva skin. Keyboard users must be able to navigate to the carousel, move between images, open and close the overlay, and reach interactive elements inside popovers using standard keyboard controls. Focus management must restore focus to the originating carousel item when the overlay is closed. Behavior must remain consistent in RTL (right-to-left) languages such as Hebrew and Arabic.

BDD

Feature: Keyboard accessibility for Image Browsing carousel and overlay

  Scenario: Navigating carousel and overlay via keyboard
    Given the user is viewing an article with Image Browsing enabled on Minerva
    When the user navigates using the Tab key
    Then the carousel component receives focus
    And arrow keys move focus between carousel items
    And pressing Enter opens the overlay
    And pressing Escape closes the overlay
    And focus returns to the previously selected carousel item
    And Tab navigation reaches content inside popover widgets within the overlay
    And behavior remains consistent under RTL languages

Test Steps

Test Case 1: Verify keyboard navigation in carousel and overlay

  1. Open https://en.wikipedia.beta.wmcloud.org/wiki/Paris?imageBrowsing=1&useskin=minerva
  2. Use the Tab key to navigate to the carousel component
  3. Use arrow keys to move between carousel items
  4. Press Enter to open the overlay
  5. Press Escape to close it
  6. AC1: Focus initially lands on the carousel container via keyboard
  7. AC2: Arrow keys move focus between carousel items
  8. AC3: Enter key opens overlay
  9. AC4: Escape key closes overlay
  10. AC5: Focus returns to the original carousel item after overlay close
  11. AC6: Tab key reaches all interactive elements in popover widgets within Detail View
  12. AC7: Keyboard navigation functions consistently in RTL languages (add &uselang=he or &uselang=ar to the URL)

Acceptance criteria

  • Keyboard navigation through tab does not focus the carousel container but goes straight to the first thumbnail (in Firefox)
  • All controls in Overlay Detail are accessible by keyboard, including those inside the share/copy popovers
  • Existing the Overlay returns focus to the carousel thumbnail

Event Timeline

Which piece of software (as in project tag) is this task about?

ovasileva triaged this task as Medium priority.Sep 10 2025, 8:11 AM
ovasileva subscribed.

Marking this medium (maybe low) priority as for now the A/B test is only meant to go for the mobile website. We can get back to this if we enter the scaling phase for this feature

@KSarabia-WMF - +1 on this. Quick question on our specific experimental structure. Given the current definition of mobile for the experiment platform, will there be cases where people would interact with the feature from desktop/have use of a keyboard and under which scenario? Depending on this we might want to raise the priority

@ovasileva The recommended carousel structure I believe is meant for mobile as well as desktop.

ovasileva set the point value for this task to 3.Sep 15 2025, 5:05 PM
ovasileva raised the priority of this task from Medium to High.Sep 16 2025, 4:53 PM

Change #1192644 had a related patch set uploaded (by LWatson; author: LWatson):

[mediawiki/extensions/ReaderExperiments@master] ImageBrowsing: improve keyboard navigation

https://gerrit.wikimedia.org/r/1192644

I'm unsure whether focus should return to the original image that was used to open the overlay, or to the last one that was visible in detail (in case another image was selected in VTOC); up to whoever implements this to think this through :)

I prefer to restore focus to the original image (CarouselItem) that was selected to open the overlay. This makes the most sense to me because the focus picks up where you last were in the carousel, and it's also a simpler implementation.
My reasoning is that interactions with images in the VTOC should only update the DetailView, not affect carousel focus. Plus, external images aren't included in the Carousel, so we'd need to handle those separately. Thoughts?

I prefer to restore focus to the original image (CarouselItem) that was selected to open the overlay. This makes the most sense to me because the focus picks up where you last were in the carousel, and it's also a simpler implementation.
Thoughts?

+1, while I wouldn’t be too surprised to see the alternative, the scenario you described would also be what I would intuitively expect

This is ready for code review and includes these changes:

  • Carousel is no longer focusable in Firefox.
  • Improves the focus ring visibility around carousel items in Firefox and Safari via padding.
  • Closing the overlay restores the focus to the carousel item that was selected to open the overlay.
  • Keyboard navigation with RTL support for left arrow, right arrow, Home, and End keys. Home and End keys navigate to the first and last carousel image.
  • Popover's interactive elements are accessible.

Change #1192644 merged by jenkins-bot:

[mediawiki/extensions/ReaderExperiments@master] ImageBrowsing: improve keyboard navigation

https://gerrit.wikimedia.org/r/1192644

This feature can now be QAed on Beta:

https://en.wikipedia.beta.wmcloud.org/wiki/Paris?imageBrowsing=1&useskin=minerva

QA steps:

  1. Use Tab key to navigate to the carousel component from the top of the page
  2. Use Tab or arrow keys to move between carousel items
  3. Use Enter and Escape keys to open and close the overlay
  4. Confirm that focus is restored to the original Carousel Item on overlay close
  5. Confirm that content inside popover widgets in the Detail View component is reachable via keyboard navigation using the Tab key
  6. Confirm that carousel keyboard nav behavior works as expected on RTL languages (use &uselang=he or ar in the URL to trigger a RTL UI).

I can confirm that all of the steps under "Test Case 1" can be completed successfully; keyboard navigation works as specified in Beta.