axe-core icon indicating copy to clipboard operation
axe-core copied to clipboard

consider allowing null values for aria attributes

Open DavidMacDonald opened this issue 9 years ago • 21 comments

Some frameworks such as SalesForce seem to place null values for aria-describedby etc... and then let content authors populate them later.

We should weigh the value of flagging those as failures (current condition) vs. assuming they are not going to damage the AT so just leave them. On one hand, they "could" be a bad reference to something they should have been referencing. On the other hand they might be there for no reason as part of the framework that can be added later, or optionally. I don't presume to know the best way to go, but it is a consideration, because I currently am showing a failure of WCAG in AXE, for something that isn't a failure. Perhaps sniff to see if there are lots of those, and if so ignore???

Invalid ARIA attribute values: aria-describedby="" aria-activedescendant=""

DavidMacDonald avatar Mar 27 '17 04:03 DavidMacDonald

One of the underlying assumptions about the use of aXe is that you are using it on the "final" state of the application. I.e. you are using it on the actual running application. Given that: I would prefer to add support for aria-busy that would turn off certain ARIA rules.

For example, it would no longer complain about missing values, missing roles etc. but would still complain about unknown attributes and wrong values/roles.

dylanb avatar Mar 27 '17 15:03 dylanb

I agree with Dylan–introducing a "this is fine for Salesforce" exception would be wrought with false positives. What if the author never populates the attributes, and we gave them a pass?

I like the idea of expanding support for aria-busy as a potential way to mitigate, since it gives us a programmatic hook for determining whether something will become populated without having to wait.

marcysutton avatar Mar 27 '17 22:03 marcysutton

I think David's suggestion is more to allow this for IDREF type aria attributes. I think that makes sense. Not having a value on aria-describedby doesn't in itself mean there is a problem. Particularly in templated systems, that's a pretty easy thing to do, example:

function input ({ name, value, type, label, help, id }) {
  var helpId = (!help ? '' : id + '-descr';
  return '<input '+
    'type="' + type +'" name="' + name '" id="'+ id '" ' +
    'value="' + value +'" aria-describedby="' + helpId '">' +
    '<label for="' + id + '">' + label +'</label>' +
     (!help ? '' : '<p class="help" id="' + helpId + '">' + help + '</p>')
}

This function creates a perfectly accessible input element, with an empty aria-describedby attribute in it. It seems to me this would be a pretty plausible scenario, so I'd be in favor of allowing IDREF attributes to be empty. Even aria-labelledby would be fine, our we already go beyond and check if whatever it refs to has text in it, so having nothing there won't impact our accessible name calculation either.

WilcoFiers avatar Mar 30 '17 10:03 WilcoFiers

What does the name calculation algorithm say about empty IDrefs and what do the screen readers do in practice with an empty aria-labelledby attribute?

dylanb avatar Mar 30 '17 16:03 dylanb

My screen reader JAWS ignored it. I don't think the calculation mentions empty values.

On Thursday, March 30, 2017 12:42 PM, Dylan Barrell <[email protected]> wrote:

What does the name calculation algorithm say about empty IDrefs and what do the screen readers do in practice with an empty aria-labelledby attribute?— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

DavidMacDonald avatar Mar 30 '17 18:03 DavidMacDonald

@DavidMacDonald we would need to confirm at least the following combinations

  1. FF and NVDA
  2. iOS, Safari, VO
  3. OS X, VO, Safari.
  4. Android, Talkback, FF

before we could make the change

dylanb avatar Apr 11 '17 14:04 dylanb

Going to bump this issue due to what ARIA 1.1 says about it.

Under 7.6 State and Property Attribute Processing in the last paragraph it states:

Sometimes states and properties are present in the DOM but have a zero-length string ("") as their value. This is equivalent to their absence. User agents SHOULD treat state and property attributes with a value of "" the same as they treat an absent attribute. For supported states and properties, this corresponds to the default value, but if it is a required attribute, it signals an author error, and the implicit value for the role is used.

Which means, no matter what the screen reader does as a side effect of an ARIA attribute being set to "", the AT is wrong.

Obviously, if the state or property is set on a role where it's explicit value must be set, then aXe should fail an empty string value. But something like aria-describedby should be totally fine

SiTaggart avatar Dec 06 '17 21:12 SiTaggart

the AT is wrong

For axe-core, that doesn't really matter. Axe-core isn't an ARIA validator. It test WCAG 2.0, which has conformance requirement 4. It requires that whatever you build works in screen readers:

Only accessibility-supported ways of using technologies are relied upon to satisfy the success criteria

So we will need this data. Shouldn't be too difficult to run tests like these, but someone needs to do it, so we'd very much welcome some test data. Until then, this issue is on hold I'm afraid.

WilcoFiers avatar Dec 07 '17 10:12 WilcoFiers

OK, but that seems somewhat counter to how aXe-core handles ARIA 1.1 attribute validation.

It allows these as valid attributes to be set but the vast majority don't work in screen readers at all, aria-haspopup="tree", aria-modal="true" etc. That definitely feels like ARIA spec validation, regardless of WCAG.

SiTaggart avatar Dec 16 '17 00:12 SiTaggart

@SiTaggart the policy for ARIA is the following:

  1. If the attribute's use is supported by all platforms: allow, else
  2. If the attribute's use does not have a negative impact on accessibility: allow, else
  3. disallow use until supported

In addition, we disallow invalid attributes starting with aria- and invalid attribute values as these are highly likely to have a negative impact on accessibility because of the scenarios under which these are likely to occur

The art is in making the decision as to what "negative impact on accessibility" means for unsupported attributes or attribute values. We are definitely open to alternative opinions and data that supports a specific negative scenario.

dylanb avatar Dec 16 '17 17:12 dylanb

So I think the conclusion is to allow IDREF elements to be empty - everyone agree?

dylanb avatar Dec 19 '17 16:12 dylanb

I think we can allow a null value on aria-describedby and aria-activedescendant. I don't see any major problems with those two. I don't think we can accept it as a blanket "allow for all". If some AT treat an empty aria-owns attribute as having no owned elements, and another ignores it and fall back to the children of that element, then this is something we shouldn't allow.

WilcoFiers avatar Dec 20 '17 10:12 WilcoFiers

@WilcoFiers Why not aria-labelledby - my testing shows that an empty ID here is ignored

Which empty IDREFs do you think will cause problems?

dylanb avatar Jan 06 '18 05:01 dylanb

@dylanb Most of them could cause problems. If a null aria-labelledby is treated by one AT as having no alternative, but another will fall back on its content (or alt or whatever), then there is a problem. All I'm saying is we need data. If you've tested in the AT we listed here and they work consistently, then we should allow it: https://github.com/dequelabs/axe-core/blob/develop/doc/accessibility-supported.md#accessibility-supported

WilcoFiers avatar Jan 06 '18 13:01 WilcoFiers

@dylanb and @WilcoFiers ,

@donnieberg put together a test page and ran this against a series of AT for you. The only items we didn't test were Talkback+Chrome and Dragon+FF (as we werent sure what to test on Dragon).

https://codepen.io/donnieberg/pen/PQrPWW

Please let us know if this is sufficient for your needs. Thanks!

cc: @SiTaggart

jhausler1266 avatar Mar 09 '18 15:03 jhausler1266

I forgot to add, we found no changes with null attributes.

jhausler1266 avatar Mar 09 '18 15:03 jhausler1266

@dylanb @WilcoFiers Can you please update us here? Does our codepen suffice?

jhausler1266 avatar Apr 10 '18 21:04 jhausler1266

@jhausler1266 This works. We'd still need the Talkback info, but if that comes out the same I think we can make the change.

WilcoFiers avatar May 01 '18 11:05 WilcoFiers

@WilcoFiers I tested out the scenarios with Talkback and updated the grid: https://codepen.io/donnieberg/pen/PQrPWW

Let @jhausler1266 and me know if you have any questions!

donnieberg avatar May 02 '18 21:05 donnieberg

@WilcoFiers are we good to go now on this? Thanks!

jhausler1266 avatar Jun 15 '18 20:06 jhausler1266