react-ui icon indicating copy to clipboard operation
react-ui copied to clipboard

Button label not shown on hover

Open mbohal opened this issue 2 years ago • 4 comments

When the <Button> component is rendered with labelVisbility set to none or to value smaller the current viewport the label value is not accessible.

I think it should appear on mouse hover.

mbohal avatar Sep 18 '23 06:09 mbohal

The invisible label does remain accessible:

obrazek

FF dev tools: obrazek

What you probably mean is the button does not provide any textual alternative to sighted users. In such case this is what you would do:

  1. add the title attribute (which may be annoying for AT users as both texts are announced: "My action, Title description, button", or something like that), or
  2. combine the button with custom Tooltip; unfortunately, RUI currently does not have such component (Popover is close, but you need to click to make it show up).

To sum it up, current behavior is correct. But I'll be happy to implement a Tooltip component which could be paired with Buttons to improve the UX while not putting accessibility at stake.

adamkudrna avatar Sep 18 '23 11:09 adamkudrna

What you probably mean is the button does not provide any textual alternative to sighted users.

Yes, that is what I had in mind.

Lets go with option 1). When we will have the component <Tooltip> we can use it here. We do not have the capacity to implement <Tooltip> at this point.

mbohal avatar Sep 18 '23 14:09 mbohal

Then I suggest putting something like this into the docs:

For icon-only buttons, consider using the title attribute to provide a textual alternative.

OK?

adamkudrna avatar Sep 22 '23 14:09 adamkudrna

@adamkudrna

I think there are two ways to solve this:

  1. Update the docs as you suggest and make user pass in both label and title props
  2. Use user specified title if provided or use the text passed in via the label prop if not provided

I think I prefer 2) developers (e.g. myself) will keep forgetting to pass in the title . Are there any arguments why 1) would be a better idea?

mbohal avatar Sep 25 '23 05:09 mbohal

The docs will be updated in the General guidelines section.

When mentioning the option to add title it should be mentioned that it will lead to aria reader a duplicit description.

mbohal avatar Jun 03 '24 12:06 mbohal

Adobe Spectrum:

Image

… but apparently, they don't implement it:

Image

The reason probably is that in Spectrum they pass the button label as children so it's not easy/possible to find out if a label is rendered or not.

adamkudrna avatar Jun 03 '24 12:06 adamkudrna