fluentui icon indicating copy to clipboard operation
fluentui copied to clipboard

IconButton has always aria-hidden property set to true.

Open mdmdakbar opened this issue 8 years ago • 6 comments

Products/sites affected: (if applicable) VSTS

Issue: I am consuming IconButton component to render an icon. But that icon has aria-hidden property set to true(always), which is leading to some accessibility issues with narrator when scan mode is on. Actually, when scan mode is on that button is not getting focus(blue colored focus when narrator is on) and get skipped.

Expected behavior: While scan mode on, blue colored focus should go on iconButtons

On investigation, I saw that there is an check based on ariaLabel prop in icon.base.tsx file.

const containerProps = ariaLabel ? { 'aria-label': ariaLabel } : { role: 'presentation', 'aria-hidden': true };

And in BaseButton.tsx, where we call Icon component we only pass iconProps and className and we are not passing ariaLabel props due to which it always renders with aria-hidden=true.

private _onRenderIcon = ( buttonProps?: IButtonProps, defaultRender?: IRenderFunction<IButtonProps> ): JSX.Element | null => { const { iconProps } = this.props; if (iconProps) { return <Icon {...iconProps} className={this._classNames.icon} />; } return null; };

Codepen repro: https://codepen.io/mdmdakbar/pen/YYPPWG

Here, I have rendered an IconButton and passed ariaLabel prop but still aria-hidden property is true

mdmdakbar avatar Jul 31 '18 09:07 mdmdakbar

Dupe of

https://github.com/OfficeDev/office-ui-fabric-react/issues/5608

dzearing avatar Jul 31 '18 21:07 dzearing

I'm not sure we are doing anything wrong here.

The button element itself is the focusable element. It has aria-label on it. The aria-hidden attribute you're referring to lives on the i element hosting the unicode value rendering the font icon. Reading this aloud would not make sense, but the button itself would.

I believe @MaxLustig discovered that this is fixed in newer versions of Narrator.

dzearing avatar Jul 31 '18 21:07 dzearing

We are not doing anything wrong specifically; the icon i itself should not be treated as text because it's a gibberish glyph, so putting aria-hidden there is the right thing to do. Now, there is a separate non-ideal issue with using just an icon for buttonText, but we are technically compliant with standards.

metapzl avatar Aug 02 '18 16:08 metapzl

I've closed #5608 since the Bug doesn't repro in a newer version of Narrator, thus we can close this one as well.

HalcyonPride avatar Aug 03 '18 23:08 HalcyonPride

@HalcyonPride - Is there some way we can test the behavior in newer version of narrator? We are facing a11y issues with each instance of IconButton used in the product (with scan mode) and would love to get some hands-on the fix, if possible.

AkshanshSrivastava03 avatar Aug 08 '18 05:08 AkshanshSrivastava03

Please see my email.

HalcyonPride avatar Aug 08 '18 17:08 HalcyonPride