Invalid ARIA attributes: Fix empty values#5040
Merged
JasonGore merged 5 commits intomicrosoft:masterfrom May 31, 2018
JasonGore:4985-invalid-aria-attributes
Merged
Invalid ARIA attributes: Fix empty values#5040JasonGore merged 5 commits intomicrosoft:masterfrom JasonGore:4985-invalid-aria-attributes
JasonGore merged 5 commits intomicrosoft:masterfrom
JasonGore:4985-invalid-aria-attributes
Conversation
… there are no associated values to display.
kenotron
approved these changes
May 30, 2018
packages/utilities/src/aria.ts
Outdated
| * @param ariaAttributes ARIA attributes to merge | ||
| */ | ||
| export function mergeAriaAttributes(...ariaAttributes: (string | undefined)[]): string | undefined { | ||
| let mergedAttribute = ''; |
Contributor
There was a problem hiding this comment.
return ariaAttributes.filter(arg => arg !== undefined && arg !== null).join(''); maybe?
Member
Author
There was a problem hiding this comment.
Sure. I like your idea of mergeAriaValues too, I think that would be more clear.
kelseyyoung
reviewed
May 31, 2018
| * ARIA helper to concatenate attributes, returning undefined if all attributes | ||
| * are undefined. (Empty strings are not a valid ARIA attribute value.) | ||
| * | ||
| * NOTE: This function will NOT insert whitespace between provided attributes. |
Member
Author
There was a problem hiding this comment.
Because all of the uses present in the codebase were already inserting spaces. This is a helper primarily to return undefined when all values are undefined, as opposed to 'undefined' string value or ''.
joschect
approved these changes
May 31, 2018
Markionium
added a commit
to Markionium/office-ui-fabric-react
that referenced
this pull request
Jun 1, 2018
* master: (95 commits) Applying package updates. Experiments/Nav component: display "show more" link only if there is atleast one hidden link (microsoft#5057) Add pointerup listener to exit keytip mode (microsoft#5051) Update PULL_REQUEST_TEMPLATE.md Update ISSUE_TEMPLATE.md Shimmer: resolve conflicts (microsoft#5034) Invalid ARIA attributes: Fix empty values (microsoft#5040) ComboBox: Correct invalid ARIA attributes. (microsoft#4873) (microsoft#5001) ComboBox: Fix submit pending value (microsoft#5048) FocusTrapZone - restore last focused descendant element (microsoft#4897) Applying package updates. Take 2 of the require.resolve change. This time using the "resolve" pkg (microsoft#5031) fixing webpack config to allow rush build to complete on a small VM (microsoft#5037) MessageBar: change color of X close button so that it is accessible (microsoft#5039) Theming: improve accessibility (microsoft#5038) Applying package updates. Added 'made with fabric' to readme (microsoft#5018) HoverCard: example accessibility fix. (microsoft#5027) Dropdown caret (microsoft#5016) Applying package updates. ...
Markionium
added a commit
to Markionium/office-ui-fabric-react
that referenced
this pull request
Jun 2, 2018
* master: (274 commits) Demo Page Refactor Part 1 (microsoft#5055) SplitButton: Add aria-roledescription (microsoft#5062) Add addins sketch toolkit link (microsoft#5052) Dropdown title (microsoft#4983) Allow for more control over event handling for keytips (microsoft#5064) Build time speed improvements (microsoft#4965) Coachmark: Positioning fixes (microsoft#4995) Applying package updates. Experiments/Nav component: display "show more" link only if there is atleast one hidden link (microsoft#5057) Add pointerup listener to exit keytip mode (microsoft#5051) Update PULL_REQUEST_TEMPLATE.md Update ISSUE_TEMPLATE.md Shimmer: resolve conflicts (microsoft#5034) Invalid ARIA attributes: Fix empty values (microsoft#5040) ComboBox: Correct invalid ARIA attributes. (microsoft#4873) (microsoft#5001) ComboBox: Fix submit pending value (microsoft#5048) FocusTrapZone - restore last focused descendant element (microsoft#4897) Applying package updates. Take 2 of the require.resolve change. This time using the "resolve" pkg (microsoft#5031) fixing webpack config to allow rush build to complete on a small VM (microsoft#5037) ...
Markionium
added a commit
to Markionium/office-ui-fabric-react
that referenced
this pull request
Jun 3, 2018
* master: (111 commits) Moving a variable to be defined sooner so that it is there when failures occur. Fix icon imports (microsoft#5069) MessageBar: More visible HC color for dismiss and expand buttons (microsoft#5061) Fix DetailsList accessibility and add more ARIA hooks (microsoft#5066) Update jest (microsoft#5068) Demo Page Refactor Part 1 (microsoft#5055) SplitButton: Add aria-roledescription (microsoft#5062) Add addins sketch toolkit link (microsoft#5052) Dropdown title (microsoft#4983) Allow for more control over event handling for keytips (microsoft#5064) Build time speed improvements (microsoft#4965) Coachmark: Positioning fixes (microsoft#4995) Applying package updates. Experiments/Nav component: display "show more" link only if there is atleast one hidden link (microsoft#5057) Add pointerup listener to exit keytip mode (microsoft#5051) Update PULL_REQUEST_TEMPLATE.md Update ISSUE_TEMPLATE.md Shimmer: resolve conflicts (microsoft#5034) Invalid ARIA attributes: Fix empty values (microsoft#5040) ComboBox: Correct invalid ARIA attributes. (microsoft#4873) (microsoft#5001) ...
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull request checklist
$ npm run changeDescription of changes
Prevent ARIA attributes from appearing with invalid empty values when there are no associated values to display.
Starting with #4985 highlighting an issue with invalid ARIA attributes in Checkbox, I found this to be a pattern affecting multiple components: BaseButton, Checkbox, ComboBox, ContextualMenuSplitButton, Dropdown, KeytipData. This PR fixes them. Also consistently default to
undefinedinstead ofnullin some instances. Created a new utility helper to merge ARIA attributes.Focus areas to test
Added unit tests for new utility function. Updated snapshots to reflect new behavior.