Skip to content

Add aria-describedby prop to Combo Box and Spin Button. Fixes #8045#8057

Merged
JasonGore merged 11 commits intomicrosoft:masterfrom
Dalimil:master
Feb 22, 2019
Merged

Add aria-describedby prop to Combo Box and Spin Button. Fixes #8045#8057
JasonGore merged 11 commits intomicrosoft:masterfrom
Dalimil:master

Conversation

@Dalimil
Copy link
Copy Markdown
Contributor

@Dalimil Dalimil commented Feb 20, 2019

Pull request checklist

Description of changes

Adds aria-describedby prop to Combo Box and Spin Button.

Microsoft Reviewers: Open in CodeFlow

@msftclas
Copy link
Copy Markdown

msftclas commented Feb 20, 2019

CLA assistant check
All CLA requirements met.

@size-auditor
Copy link
Copy Markdown

size-auditor bot commented Feb 20, 2019

Size Auditor did not detect a change in bundle size for any component!

@Dalimil
Copy link
Copy Markdown
Contributor Author

Dalimil commented Feb 20, 2019

@JasonGore Can you take another look? Thanks :-)

@JasonGore
Copy link
Copy Markdown
Contributor

Can you add some unit tests to make sure the prop is applied correctly? You can search the codebase for similar examples. This will help prevent regressions to the prop you've added. Thanks!

@Dalimil
Copy link
Copy Markdown
Contributor Author

Dalimil commented Feb 21, 2019

@JasonGore Updated.

Copy link
Copy Markdown
Member

@KevinTCoughlin KevinTCoughlin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very much appreciate the change and the test coverage @Dalimil. I'm blocking for now given the usage of mergeAriaAttributeValues since it could lead to invalid ARIA values. See below:


We need to take a look at mergeAriaAttributeValues given the value for aria-describedby must be an "ID reference list". Does the value need to be space delimited?

https://github.com/OfficeDev/office-ui-fabric-react/blob/c987deb47aacad388b4a8d204e6c379aa8019bcd/packages/utilities/src/aria.ts#L5

https://www.w3.org/WAI/PF/aria-1.1/states_and_properties#aria-describedby

MDN states the value should be:

a space-separated list of element IDs

https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-describedby_attribute#Value

cc: @natalieethell

@Dalimil
Copy link
Copy Markdown
Contributor Author

Dalimil commented Feb 21, 2019

@KevinTCoughlin Sorry, yes, I forgot the space. I think I may have seen similar usage somewhere else in the codebase so I think that's why I got confused.

@JasonGore
Copy link
Copy Markdown
Contributor

Might be a good idea to update the unit test to verify spacing is present too. I need to revisit that utility to deal with spaces or not spaces accordingly and handle both cases.

@Dalimil
Copy link
Copy Markdown
Contributor Author

Dalimil commented Feb 21, 2019

@JasonGore I updated the unit tests.

@KevinTCoughlin
Copy link
Copy Markdown
Member

@KevinTCoughlin Sorry, yes, I forgot the space. I think I may have seen similar usage somewhere else in the codebase so I think that's why I got confused.

Cool, yea it looks like we have an issue elsewhere in the codebase that we'll address separately (PR linked). For this PR, your approach looks acceptable. I will update this instance if need be with the follow-up PR.

Thanks for your patience and updates!

@KevinTCoughlin
Copy link
Copy Markdown
Member

Hrmmm actually the snapshots are failing because now in the default case they'll receive a space as the value for aria-describedby 😅, see https://travis-ci.org/OfficeDev/office-ui-fabric-react/builds/496641268#L2080.

Can you easily guard against that case? If not, I should be able to resolve the underlying issue with mergeAriaAttributeValues by EOD.

@KevinTCoughlin
Copy link
Copy Markdown
Member

KevinTCoughlin commented Feb 21, 2019

@Dalimil what about this ternary as a workaround to unblock your PR:

mergeAriaAttributeValues('one', ' ', 'two')
"one two"

mergeAriaAttributeValues(undefined, ' ', undefined)
" "

let foo = 'foo'
mergeAriaAttributeValues(foo, foo ? ' ' : undefined, 'bar')
"foo bar"

foo = undefined
mergeAriaAttributeValues(foo, foo ? ' ' : undefined, 'bar')
"bar"

mergeAriaAttributeValues(foo, foo ? ' ' : undefined, undefined)
undefined

I can clean it up in the follow-up PR.

@Dalimil
Copy link
Copy Markdown
Contributor Author

Dalimil commented Feb 21, 2019

@KevinTCoughlin I think that should be fixed now.

@Dalimil
Copy link
Copy Markdown
Contributor Author

Dalimil commented Feb 21, 2019

@JasonGore Are we ready to merge this now?

@JasonGore
Copy link
Copy Markdown
Contributor

I've approved it, Kevin has the block. 😄

Copy link
Copy Markdown
Member

@KevinTCoughlin KevinTCoughlin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit: minor suggestion re: utilities package change-note. Otherwise LGTM.

We'll still need to fix mergeAriaAttributeValues in a separate PR. Thanks for this contribution and bringing the utility issue to our attention!

@Dalimil
Copy link
Copy Markdown
Contributor Author

Dalimil commented Feb 21, 2019

@JasonGore @KevinTCoughlin The previous build failed because of a long line in a different part of the codebase (someone must have changed something in the meantime). I fixed the tslint issue, so hopefully it's fine now.

@Dalimil
Copy link
Copy Markdown
Contributor Author

Dalimil commented Feb 22, 2019

@JasonGore @KevinTCoughlin Should be good to go!

@JasonGore JasonGore merged commit 2f516dd into microsoft:master Feb 22, 2019
@msft-github-bot
Copy link
Copy Markdown
Contributor

🎉office-ui-fabric-react@v6.143.0 has been released which incorporates this pull request.:tada:

Handy links:

1 similar comment
@msft-github-bot
Copy link
Copy Markdown
Contributor

🎉office-ui-fabric-react@v6.143.0 has been released which incorporates this pull request.:tada:

Handy links:

@msft-github-bot
Copy link
Copy Markdown
Contributor

🎉@uifabric/utilities@v6.29.3 has been released which incorporates this pull request.:tada:

Handy links:

1 similar comment
@msft-github-bot
Copy link
Copy Markdown
Contributor

🎉@uifabric/utilities@v6.29.3 has been released which incorporates this pull request.:tada:

Handy links:

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No way to set ariaDescription on SpinButton or ComboBox

5 participants