Skip to content

Conversation

@JustSlone
Copy link
Collaborator

@JustSlone JustSlone commented Nov 6, 2020

Pull request checklist

  • Addresses an existing issue: Fixes internal issue
  • Include a change request file using $ yarn change

Description of changes

Thanks to an suggestion from someone more familiar with this space, found a much better fix.
Simply applying aria-live="assertive" to the hex and RGBA fields results in the screenreader announcing any changes made to these fields.

Choices are polite or assertive. I choose assertive as it works a bit better with the flow, it still announces the change made, but then immediately announces the other changes. Also other ColorPickers use aria-live="assertive".

The core issue here is that when a user enters a value > 255 (or >100) in the RGBA fields of ColorPicker, screen readers make it seem like the invalid value was entered successfully, however when the user moves to the next field ColorPicker resets the value to 255, without announcing to the user.

This fix adds role="spinbutton" and the appropriate spinbutton aria properties to the RGBA fields. The aria-valuenow attribute is updated with the correct clamped value resulting in the screen reader announcing the proper value even if the edit box is currently displaying an invalid value.

Focus areas to test

ColorPicker with screen reader, need to try multiple incorrect values is in the RGBA textfields

@msft-github-bot msft-github-bot added the needs cherry-pick Temporary label for PRs which may need to be cherry-picked to master label Nov 6, 2020
@codesandbox-ci
Copy link

codesandbox-ci bot commented Nov 6, 2020

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 5ea01a0:

Sandbox Source
Fluent UI Button Configuration
codesandbox-react-template Configuration

@msft-github-bot
Copy link
Contributor

msft-github-bot commented Nov 6, 2020

Perf Analysis

No significant results to display.

All results

Scenario Render type 7.0 Ticks PR Ticks Iterations Status
BaseButton mount 962 958 5000
Breadcrumb mount 42379 42734 5000
Checkbox mount 1662 1734 5000
CheckboxBase mount 1435 1417 5000
ChoiceGroup mount 5255 5307 5000
ComboBox mount 999 977 1000
CommandBar mount 8011 7967 1000
ContextualMenu mount 13738 13809 1000
DefaultButton mount 1218 1196 5000
DetailsRow mount 3719 3826 5000
DetailsRowFast mount 3818 3877 5000
DetailsRowNoStyles mount 3663 3658 5000
Dialog mount 1591 1617 1000
DocumentCardTitle mount 1838 1891 1000
Dropdown mount 2751 2984 5000
FocusTrapZone mount 1796 1788 5000
FocusZone mount 1888 1872 5000
IconButton mount 1915 1896 5000
Label mount 340 337 5000
Layer mount 2072 2076 5000
Link mount 482 478 5000
MenuButton mount 1578 1575 5000
MessageBar mount 2190 2091 5000
Nav mount 3545 3423 1000
OverflowSet mount 1506 1515 5000
Panel mount 1513 1548 1000
Persona mount 868 860 1000
Pivot mount 1496 1475 1000
PrimaryButton mount 1401 1381 5000
Rating mount 8193 8265 5000
SearchBox mount 1378 1430 5000
Shimmer mount 2734 2767 5000
Slider mount 1597 1635 5000
SpinButton mount 5243 5309 5000
Spinner mount 421 409 5000
SplitButton mount 3402 3689 5000
Stack mount 532 543 5000
StackWithIntrinsicChildren mount 1638 1586 5000
StackWithTextChildren mount 5031 4997 5000
SwatchColorPicker mount 10736 10855 5000
TagPicker mount 2835 2916 5000
TeachingBubble mount 51578 52250 5000
Text mount 462 467 5000
TextField mount 1491 1504 5000
Toggle mount 893 888 5000
button mount 118 109 5000

@size-auditor
Copy link

size-auditor bot commented Nov 6, 2020

Asset size changes

Project Bundle Baseline Size New Size Difference
office-ui-fabric-react office-ui-fabric-react-ColorPicker 86.204 kB 86.245 kB ExceedsBaseline     41 bytes

ExceedsTolerance Over Tolerance (1024 B) ExceedsBaseline Over Baseline BelowBaseline Below Baseline New New Deleted  Removed 1 kB = 1000 B

Baseline commit: fef6e99987f44a41ee46faf1db217d9c6d44109a (build)

@ecraig12345 ecraig12345 closed this Nov 6, 2020
@ecraig12345 ecraig12345 reopened this Nov 6, 2020
@ecraig12345 ecraig12345 closed this Nov 6, 2020
@ecraig12345 ecraig12345 reopened this Nov 6, 2020
@JustSlone
Copy link
Collaborator Author

Oh shoot, didn't update the snapshots, will need to look into that.

Let me know if you have any feedback on the code/approach.

@JustSlone
Copy link
Collaborator Author

Updated to remove hex field from set of fields, originally thought it should be included, but now realize that it's duplicative information since the RGBA fields are enough to understand what the color is. Also screen readers don't do a great job reading the hex field.

@ecraig12345 are you able to review this soon? Folks are waiting on this fix

@@ -0,0 +1,8 @@
{
"type": "minor",
Copy link
Member

Choose a reason for hiding this comment

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

Not super important but this is probably patch since it's not an API change.

Suggested change
"type": "minor",
"type": "patch",

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Let's keep it minor since it's a DOM structure addition

Copy link
Member

Choose a reason for hiding this comment

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

I wouldn't generally say adding an attribute qualifies as a structure change (that's more about adding/removing/moving elements). But if you'd still rather keep it as a minor change that's fine.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sorry, yes you are correct on the terminology. It's not so much DOM structure as a general DOM change.

I guess the way I see it is that since aspire to treat DOM attribute removal as a major, we should treat DOM attribute addition as a minor. It's really a stretch, but also it seems better to be conservative on patch vs. minor.

Good to discuss these points though.

@JustSlone JustSlone merged commit 922a86f into microsoft:7.0 Nov 17, 2020
@JustSlone JustSlone changed the title Update ColorPicker to treat RGBA input as aria spinbutton Update ColorPicker to announce changes to RGBA fields, even when field is not focused Nov 18, 2020
@msft-github-bot
Copy link
Contributor

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

Handy links:

@kubkon kubkon self-assigned this Jan 29, 2021
kubkon pushed a commit to kubkon/fluentui that referenced this pull request Jan 29, 2021
Update ColorPicker to announce clamping of RGBA values

When a user types an invalid number in an RGBA field in ColorPicker then changes focus from that field ColorPicker will update the field to a valid value. However, this change was not being announced by screen readers, which is an issue as a non-sighted user is unable to know about the new value. This change adds aria-live="assertive" to announce the change to the user even when they are not focused on the field.

Co-authored-by: Justin Slone <justin.slone@microsoft.com>
@ecraig12345 ecraig12345 removed the needs cherry-pick Temporary label for PRs which may need to be cherry-picked to master label Feb 2, 2021
ecraig12345 pushed a commit that referenced this pull request Feb 2, 2021
…15855) (#16709)

* Update ColorPicker to announce clamping of RGBA values (#15855)

Update ColorPicker to announce clamping of RGBA values

When a user types an invalid number in an RGBA field in ColorPicker then changes focus from that field ColorPicker will update the field to a valid value. However, this change was not being announced by screen readers, which is an issue as a non-sighted user is unable to know about the new value. This change adds aria-live="assertive" to announce the change to the user even when they are not focused on the field.

Co-authored-by: Justin Slone <justin.slone@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants