fluentui icon indicating copy to clipboard operation
fluentui copied to clipboard

[Accessibility][Button]Default Button has invalid ARIA attribute value

Open caitlinthefirst opened this issue 9 years ago • 10 comments

Package Version: Current - Component Library Demo Site Browser: Chrome

This issue is based on automated testing with the aXe extension for Chrome.

Issue Description

URL: https://dev.office.com/fabric#/components/button

Default Button has invalid ARIA attribute value: e.g. aria-labelledby="Button68" There is no id="Button68". This is a critical accessibility issue according to WCAG 2.0 A standards.

##How to Reproduce Go to https://dev.office.com/fabric#/components/button and run aXe. Look for the "ARIA attributes must conform to valid values" issues.

Current Behavior

There are 6 occurrences of aria-labelledby and/or aria-describedby being set to a non-existent value. Assistive Technologies (like screen readers) cannot find the necessary information.

Expected behavior

The value of each aria-labelledby and aria-describedby must be a value of an id that is currently set on the page.

caitlinthefirst avatar Mar 04 '17 19:03 caitlinthefirst

@caitlinthefirst Hi, I believe that this was fixed in the big button update. Could you confirm?

joschect avatar Mar 24 '17 16:03 joschect

@joschect The problem is arising with incorrectly assigning the ariaLabelledby variable here: https://github.com/OfficeDev/office-ui-fabric-react/blob/0859b57d68263004fd6ffc3c035520c7d98b9dd6/packages/office-ui-fabric-react/src/components/Button/BaseButton.tsx#L75 This issue arises when "_labelId" isn't a valid id in the DOM. I don't understand why is that assigned to "aria-labelledby".

Hardhik avatar Apr 20 '17 10:04 Hardhik

Hmmm... We're getting a little bit outside my wheelhouse. I'll try to pull in some additional help. Thanks for working on the issue!

On Thu, Apr 20, 2017 at 6:37 AM, Hardhik [email protected] wrote:

@joschect https://github.com/joschect The problem is arising with incorrectly assigning the ariaLabelledby variable here: https://github.com/OfficeDev/office-ui-fabric-react/blob/ 0859b57d68263004fd6ffc3c035520c7d98b9dd6/packages/office-ui- fabric-react/src/components/Button/BaseButton.tsx#L75 This issue arises when "_labelId" isn't a valid id in the DOM. I don't understand why is that assigned to "aria-labelledby".

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/OfficeDev/office-ui-fabric-react/issues/1176#issuecomment-295676095, or mute the thread https://github.com/notifications/unsubscribe-auth/AYIndJmmus0fkf8Q_LjjtP0_mGx0YtRVks5rxzV-gaJpZM4MTLdT .

-- Caitlin Cashin Marketing Manager Deque Systems Tel: 703 225 0380 Cell: 703 307 2195 www.deque.com

Follow Us on Twitter https://twitter.com/dequesystems, LinkedIn http://www.linkedin.com/company/deque-systems-inc, and Facebook https://www.facebook.com/dequesystems.

caitlinthefirst avatar Apr 20 '17 13:04 caitlinthefirst

It's hard to tell where the problem originates exactly since most of those props are passed in, but the "ID"s used with aria-labelledby in buttons and picked up by aXe on this page are all numbers, which don't make valid DOM IDs. They also don't match any elements in the DOM–what should those IDs be matching?

Looks like the getID and support functions need to do a little more work to be a good fallback method for when ariaLabel isn't present. Or the component could try to enforce an ariaLabel perhaps? That would be a good IDE linting feature.

marcysutton avatar Apr 20 '17 15:04 marcysutton

I'm confused, I see that default button is working as expected. Do those not match up in the way we expect? The only one that seems like it would have an incorrect label would be the IconButton since it never calls the label render function. image

joschect avatar Apr 20 '17 16:04 joschect

I could be misunderstanding something.

joschect avatar Apr 20 '17 16:04 joschect

There are still two issues here:

  1. DOM ID's can't start with a number. Add a non-numeric string to the beginning of that ID, and it should work.

  2. Not all instances of buttons in the demo page have an ID in them. Here's an icon button in the demo site interface that doesn't: Button element open in DevTools

marcysutton avatar Apr 20 '17 16:04 marcysutton

Okay, that makes more sense. We'll need to change that getId function and then alter the way that iconButton works.

joschect avatar Apr 20 '17 23:04 joschect

Does anyone have any updates on this?

Hardhik avatar May 19 '17 09:05 Hardhik

This issue also affects buttons in Nav components. On the Nav demo page (https://developer.microsoft.com/en-us/fabric#/components/nav) inspect the first menu item (Variants > Basic Nav Bar > Home button) and this element also has an aria-describedby which is numeric and there is no element with this id on the page. image