Fix invalid mergeAriaAttributeValues output when multiple ID references supplied#8113
Conversation
packages/office-ui-fabric-react/src/components/__snapshots__/Keytips.Button.Example.tsx.shot
Show resolved
Hide resolved
JasonGore
left a comment
There was a problem hiding this comment.
The concern I had in making this change is that we continue to return undefined when given empty strings as input. Can you add test cases like this and verify the continue to work as expected?
{
args: ['', ''],
expected: undefined
},
{
args: [' ', ' '],
expected: undefined
},
Great suggestion @JasonGore! Done in 0c5bede. |
|
Hello @KevinTCoughlin! Because this pull request has the |
|
🎉 Handy links: |
|
🎉 Handy links: |
Pull request checklist
$ npm run changeDescription of changes
The Problem
Reviewing #8057 brought to my attention that
mergeAriaAttributeValuesis producing invalid values foraria-describedbywhen it receives multiple input values unless the consumer knows to supply the space padding themselves.Currently, the helper is concatenating the values without a space which screen reader technology does not understand.
Example: The output
elementId1elementId2should beelementId1 elementId2where each string refers to the ID attribute of an element in the DOM.I believe that the helper should space-delimit the output by default to minimize the risk of introducing ARIA bugs and/or regressions. Currently, the helper is only used for
aria-describedbyvalues within OUFR.I'm unaware of an a11y scenario where we would want the output values concatenated without a space.
Repro
This Codepen illustrates the problem with Narrator enabled as you focus the two buttons. One of the buttons has its
aria-describedbyvalue space-delimited while the other does not. Narrator only reads the space-delimited values.Narrator Output
MDN states that
aria-describedbyand similar attributes must have the value of:This "space-separated list of element IDs" is referred to as a "ID reference list" in the W3 ARIA spec.
Focus areas to test
KeyTipshould now be correctly read by the screen-reader.Microsoft Reviewers: Open in CodeFlow