ContextualMenu has aria-labelledBy referencing element not in DOM#4963
Conversation
Fix: - Factor out logic to test whether button has associated text - Check menuProps for explicit label/labelledby - Do not add labelledBy unless there's no explicit label and text exists
…c-react into BaseButton_ContextMenu_AriaLabelledBy
|
Hmm, this seems like a good candidate for a test with and without text to verify prop does and doesn't appear as expected (and to protect against regression) |
jspurlin
left a comment
There was a problem hiding this comment.
Let's add a test to help make sure this doesn't regress, but other than that this looks good!
| } = this.props; | ||
|
|
||
| if (text || typeof (children) === 'string' || secondaryText) { | ||
| if (this._hasText() || secondaryText) { |
There was a problem hiding this comment.
Wanted to point out that the refactor actually made this a stricter check. Before, if text was null and typeof (children) === 'string' evaluated to true, the if was true. Now, text must be undefined for typeof (children) check to make the if truthy. I think this was the original intention because falling back to string children for text is supposed to be for backward compatibility and assumes text property is not present, but it's still a change that I want scrutinized by reviewers. #Resolved
There was a problem hiding this comment.
Thanks for bring this up. While I agree that this seems safe, let's not change the logic because it may have a ripple effect for some consumers. Feel free to log a bug and list it in a comment inside of _hasText so that it can be addressed later
There was a problem hiding this comment.
There was a problem hiding this comment.
|
Iteration 4 In reply to: 391440443 [](ancestors = 391440443) |
* master: Applying package updates. Shimmer: refactor in preparation for migration to OUFR (microsoft#4958) Applying package updates. Theming: fix error colors (microsoft#4969) MaskedTextField: Added event callback passthrough (microsoft#4956) Experiments/Nav component: Enable auto expand until the next manual expand disables the auto expand (microsoft#4996) Applying package updates. Experiments/Nav component: Auto select/expand based on the selectedKey prop (microsoft#4984) StickyPane: fix Array.from in Ie (microsoft#4982) ContextualMenu has aria-labelledBy referencing element not in DOM (microsoft#4963) Keyboard support for the slim version of experiments/Nav component and added aria attributes (microsoft#4981) Move ghdocs to wiki (microsoft#4977) Remove build artifacts (microsoft#4976) Revisited the Multi-select Combo box initial state selection fix (microsoft#4884) Applying package updates. readme cleanup (microsoft#4972) Theming: add the bodyBackgroundDarker semantic slot (microsoft#4957) Improvements for auto-select opt-in mode (microsoft#4914)
* master: (85 commits) Applying package updates. Shimmer: refactor in preparation for migration to OUFR (microsoft#4958) Applying package updates. Theming: fix error colors (microsoft#4969) MaskedTextField: Added event callback passthrough (microsoft#4956) Experiments/Nav component: Enable auto expand until the next manual expand disables the auto expand (microsoft#4996) Applying package updates. Experiments/Nav component: Auto select/expand based on the selectedKey prop (microsoft#4984) StickyPane: fix Array.from in Ie (microsoft#4982) ContextualMenu has aria-labelledBy referencing element not in DOM (microsoft#4963) Keyboard support for the slim version of experiments/Nav component and added aria attributes (microsoft#4981) Move ghdocs to wiki (microsoft#4977) Remove build artifacts (microsoft#4976) Revisited the Multi-select Combo box initial state selection fix (microsoft#4884) Applying package updates. readme cleanup (microsoft#4972) Theming: add the bodyBackgroundDarker semantic slot (microsoft#4957) Improvements for auto-select opt-in mode (microsoft#4914) Applying package updates. Revert ChoiceGroup change in 5.0 to minimize potential partner impact. (microsoft#4962) ...
Pull request checklist
$ npm run changeDescription of changes
Focus areas to test
Easily tested using OverflowSet:
Reviewers:
@joschect
@jspurlin
Microsoft Reviewers: Open in CodeFlow