Page MenuHomePhabricator

'Report an issue with dark mode' button not keyboard-focusable
Closed, ResolvedPublic

Description

"Report an issue with dark mode" link/control - which is implemented as an <a> element without href, so it's not keyboard-focusable. also, it acts as a button rather than being a link, and just transforms into a static bit of text once you click it with the mouse, so they'd also need to handle focus there after activation

(Reporting on behalf of Patrick H. Lauke on Mastodon)

image.png (229×496 px, 25 KB)

Requirement

Ensure that the "Report an issue with dark mode" button is keyboard-focusable and behaves like a button, retaining focus after activation.

BDD

Feature: Improve Accessibility of the "Report an issue with dark mode" Button

  Scenario: Keyboard accessibility for the "Report an issue with dark mode" button
    Given the user is navigating with a keyboard
    When the user tabs to the "Report an issue with dark mode" button
    Then the button should be focusable

  Scenario: Focus management after activation
    Given the user clicks the "Report an issue with dark mode" button
    When the button transforms into static text
    Then the focus should be retained on the static text

Test Steps

Test Case 1: Verify Keyboard Accessibility for the "Report an issue with dark mode" Button

  1. Navigate to the page with the "Report an issue with dark mode" button.
  2. Use the keyboard to tab through the interactive elements.
  3. AC1: Confirm that the "Report an issue with dark mode" button is keyboard-focusable.

Test Case 2: Verify Focus Management After Button Activation

  1. Use the keyboard or mouse to activate the "Report an issue with dark mode" button.
  2. AC2: Confirm that focus is retained on the static text after the button is clicked.

QA Results - Beta

ACStatusDetails
1T371377#10034037

QA Results - Prod

ACStatusDetails
1T371377#10055758
2T371377#10055758

Details

Related Changes in Gerrit:

Event Timeline

currently, the markup for this is just <a>Report an issue...</a>. Anchor elements without an href attribute are not keyboard focusable.

*When not logged in*, the control acts as a button to trigger an action (rather than navigating somewhere, which is what links are for), it should be coded as a <button> element (and styled accordingly to make it look the same as now, if you want). Make sure to have a focus indicator/outline when it receives keyboard focus too.

Once activated, the control turns into static text that just confirms the submission. This should be made explicitly focusable using tabindex="0" and focus moved to it programmatically using .focus() method (otherwise, focus will be lost/reset to the start of the page for screen reader users).

*When logged in* (which I only just discovered), the control actually does open a new page and acts as a link and opens "https://www.mediawiki.org/wiki/Reading/Web/Accessibility_for_reading/Reporting/..." in a new tab. I'd say even in this case though, it makes sense to initially expose the control as a <button>.

If it's not possible to use actual <button> markup, you can keep it an <a> element, but make it explicitly keyboard-focusable and give it a role of button - <a tabindex="0" role="button">Report an issue...</a>

Incidentally, when the appearance panel is hidden and turned into a dropdown, the fact that the control is not focusable becomes even more obvious and annoying, as a user will tab through the radio buttons, expecting to reach the "Report..." control, and instead they jump out of the dropdown.

{F56788174}

@Jdlrobson I was looking at this, and there is more going on here that i do not understand...

// per requirements: only logged in users can report errors

And then for users its adds an href and a target attribute... but it DOES add the element itself and a 'success' handler for anon users...
This seems strange... are we just pretending that anon users can provide feedback ? Or are we accidentally adding that element when we shouldnt be ?

This seems strange... are we just pretending that anon users can provide feedback ? Or are we accidentally adding that element when we shouldnt be ?

We were supposed to be logging events on every click, and then the idea was to provide summaries of that data to the community.
However, as we started working on generating these reports in T370233 we discovered a bug (T371325) which meant this isn't working so we're currently in the process of re-evaluation (T370825).
We want anons to provide feedback but there are concerns (not mine) that if we push them to the talk page, we'll get a lot of spam/useless reports from IP users.

This seems strange... are we just pretending that anon users can provide feedback ? Or are we accidentally adding that element when we shouldnt be ?

We were supposed to be logging events on every click, and then the idea was to provide summaries of that data to the community.
However, as we started working on generating these reports in T370233 we discovered a bug (T371325) which meant this isn't working so we're currently in the process of re-evaluation (T370825).
We want anons to provide feedback but there are concerns (not mine) that if we push them to the talk page, we'll get a lot of spam/useless reports from IP users.

right.. so for now it doesn't do anything for anons other than show a notification and that is expected.

Change #1058253 had a related patch set uploaded (by TheDJ; author: TheDJ):

[mediawiki/skins/Vector@master] Make fake link a button

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

Change #1058253 merged by jenkins-bot:

[mediawiki/skins/Vector@master] Make fake link a button

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

@Jdlrobson Can you please validate the gif, if this is what you want for keyboard focus? It shows I can navigate into the section by pressing the tab button. While in the color section, I can navigate by using the up/down arrows. To get to 'report an issue with dark mode', I have to push the tab button. When I click the Enter button, it goes to the Editing Reading/Web/Accessibility for reading/Reporting/en.wikipedia.beta.wmflabs.org (new section) page (ex. https://www.mediawiki.org/wiki/Reading/Web/Accessibility_for_reading/Reporting/en.wikipedia.beta.wmflabs.org?section=new&action=submit&preloadtitle=[https://en.wikipedia.beta.wmflabs.org/wiki/Robert_Mambo_Mumba%20Robert%20Mambo%20Mumba]%20dark%20mode%20error&preload=MediaWiki:vector-night-mode-issue-reporting-preload-content)

Test Result - Beta

Status: ✅ PASS
Environment: Beta
OS: macOS Sonoma 14.5
Browser: Chrome 127
Device: MBA
Emulated Device: NA

Test Step(s):

  1. Visit any page (ex. https://en.wikipedia.beta.wmflabs.org/wiki/Robert_Mambo_Mumba#cite_note-3)
  2. Make sure you can keyboard tab/arrow in and out of the section and choose the color, along with reporting an issue going to the correct page.
Keyboard Focus

2024-08-01_08-04-17.mp4.gif (1,418×930 px, 1 MB)

Keyboard Focus w/o Sidebar
2024-08-02_07-24-03.mp4.gif (1,092×836 px, 1 MB)
href "Report an issue with dark mode"
2024-08-01_08-01-30.png (3,359×1,359 px, 681 KB)
GMikesell-WMF updated the task description. (Show Details)
GMikesell-WMF added a subscriber: Edtadros.
Edtadros added a project: Verified.

Test Result - Prod

Status: ✅ PASS
Environment: enwiki
OS: macOS Sonoma
Browser: Chrome
Device: MBA
Emulated Device: NA

Test Artifact(s):

Test Steps

Test Case 1: Verify Keyboard Accessibility for the "Report an issue with dark mode" Button

  1. Navigate to the page with the "Report an issue with dark mode" button.
  2. Use the keyboard to tab through the interactive elements.
  3. AC1: Confirm that the "Report an issue with dark mode" button is keyboard-focusable.

screenshot.mov.gif (1,488×800 px, 2 MB)

Test Case 2: Verify Focus Management After Button Activation

  1. Use the keyboard or mouse to activate the "Report an issue with dark mode" button.
  2. AC2: Confirm that focus is retained on the static text after the button is clicked.

screenshot 2.png (1,489×800 px, 456 KB)