Skip to content

FIX accessibility: make copy-to-clipboard icons "keyboard-operable" in HTML displays - #34429

Merged
lorentzenchr merged 10 commits into
scikit-learn:mainfrom
DeaMariaLeon:accessi-html
Jul 21, 2026
Merged

lorentzenchr merged 10 commits into
scikit-learn:mainfrom
DeaMariaLeon:accessi-html

Conversation

@DeaMariaLeon

@DeaMariaLeon DeaMariaLeon commented Jul 3, 2026 •

Copy link
Copy Markdown
Member

Reference Issues/PRs

Towards #34366

Screenshot 2026-07-03 at 15 09 24

What does this implement/fix? Explain your changes.

This PR fixes accessibility issue "Device dependent event handler" found using WAVE.

These warnings show up with "mouse-only" handlers placed on elements that lack links or controls -- because they can't be reached with a keyboard.
For more information: Operable user interface and navigation

The copy-to-clipboard icon in the HTML displays can only be activated with a mouse.
(There are many other elements in the displays that are reached only with hover.)

Changed the <i> to <button> since buttons are "keyboard-operable" by default.
Also added aria-label - to add an accessible name to the button.

From the mdn docs:
An accessible name is the name of a user interface element; it is the text associated with an HTML element that provides users of assistive technology with a label for the element.

First time contributor introduction

AI usage disclosure

I used AI assistance for:

  • Research and understanding

Any other comments?

Not ready for review

This PR seems to fix the issues I mentioned above:

Screenshot 2026-07-03 at 17 14 53

@DeaMariaLeon DeaMariaLeon moved this to In progress in Labs Jul 3, 2026
@DeaMariaLeon DeaMariaLeon added this to Labs Jul 3, 2026
@DeaMariaLeon
DeaMariaLeon marked this pull request as ready for review July 6, 2026 15:00
@DeaMariaLeon

DeaMariaLeon commented Jul 7, 2026 •

Copy link
Copy Markdown
Member Author

To reviewers:
One should check that the copy-to-clipboard buttons in the parameters' table are "focusable" and can be keyboard activated. Users must be shown where they are in the table -- for accessibility as well.

Link to built example

WAVE report with the 207 alerts cleared

Goal of this PR:
- SimpleImputer

FYI @ogrisel @StefanieSenger

@DeaMariaLeon DeaMariaLeon moved this from In progress to PR waiting for reviews in Labs Jul 7, 2026
@DeaMariaLeon

Copy link
Copy Markdown
Member Author

It doesn't work on Safari. None of the fixes that use button or tab will work on Safari.

It's an old Safari's bug https://bugs.webkit.org/show_bug.cgi?id=22261

@ogrisel

ogrisel commented Jul 13, 2026

Copy link
Copy Markdown
Member

Please add changelog entries for this kind of accessibility fixes.

@ogrisel ogrisel left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks this looks good to me. I tried the rendered example in firefox and chrome and I confirm copy and paste is actionable from the keyboard.

One thing I observed on the example though: in firefox and chrome, when navigating via "tab", if the SimpleImputer blocked is collapsed, I can select the question mark icon, but not the SimpleImputer block itself nor its arrow to expand it.

I think we should make the array or the block itself expandable to make it possible to then select inner components such as the copypaste buttons.

I checked that the output features blocks can be selected via the tab key but not the estimator blocks.

Let's do that in a follow-up PR to keep things easy to review.

@DeaMariaLeon

Copy link
Copy Markdown
Member Author

I think we should make the array or the block itself expandable to make it possible to then select inner components such as the copypaste buttons.

I was working on it as well - it's in the oven.

@DeaMariaLeon DeaMariaLeon added the Waiting for Second Reviewer First reviewer is done, need a second one! label Jul 15, 2026

@lorentzenchr lorentzenchr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@lorentzenchr lorentzenchr changed the title Fix accessibility: make copy-to-clipboard icons "keyboard-operable" in HTML displays FIX accessibility: make copy-to-clipboard icons "keyboard-operable" in HTML displays Jul 21, 2026
@lorentzenchr
lorentzenchr merged commit ff12a43 into scikit-learn:main Jul 21, 2026
39 checks passed
@github-project-automation github-project-automation Bot moved this from PR waiting for reviews to Done in Labs Jul 21, 2026
@DeaMariaLeon
DeaMariaLeon deleted the accessi-html branch July 21, 2026 11:42
@DeaMariaLeon

Copy link
Copy Markdown
Member Author

Thank you

@lorentzenchr

Copy link
Copy Markdown
Member

De rien. In my own PRs, I also don’t want to wait forever for such small changes.

prady0t pushed a commit to prady0t/scikit-learn that referenced this pull request Sep 2, 2026
@jeremiedbb jeremiedbb mentioned this pull request Sep 8, 2026
14 tasks done
jeremiedbb pushed a commit to jeremiedbb/scikit-learn that referenced this pull request Sep 9, 2026
jeremiedbb pushed a commit to jeremiedbb/scikit-learn that referenced this pull request Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module:utils Waiting for Second Reviewer First reviewer is done, need a second one!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants