Skip to content

Commit

Permalink
fix: MenuButton is styled correctly when aria-expanded is a string (m…
Browse files Browse the repository at this point in the history
  • Loading branch information
smhigley authored Jun 25, 2024
1 parent 1e1398c commit 3fe95fd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "fix: MenuButton is styled correctly when aria-expanded is a string",
"packageName": "@fluentui/react-button",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ export const useMenuButton_unstable = (
'use no memo';

const buttonState = useButton_unstable(props, ref);
buttonState.root['aria-expanded'] = props['aria-expanded'] ?? false;
// force aria-expanded to be a boolean, not a string
buttonState.root['aria-expanded'] = props['aria-expanded']
? props['aria-expanded'] === 'true' || props['aria-expanded'] === true
: false;

return {
// Button state
Expand Down

0 comments on commit 3fe95fd

Please sign in to comment.