Skip to content

Commit

Permalink
fix: ContextualMenuSplitButton always sets aria-checked (does not lea…
Browse files Browse the repository at this point in the history
…ve it undefined) when it is checkable (microsoft#27650)

* fix: ContextualMenuSplitButton always sets aria-checked (does not leave it undefined) when it is checkable.

* Adding change file.
  • Loading branch information
khmakoto authored and marcosmoura committed Apr 25, 2023
1 parent 5c489e4 commit 133e4ae
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "fix: ContextualMenuSplitButton always sets aria-checked (does not leave it undefined) when it is checkable.",
"packageName": "@fluentui/react",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
import { ContextualMenuItem } from '../ContextualMenuItem';
import { getSplitButtonVerticalDividerClassNames } from '../ContextualMenu.classNames';
import { KeytipData } from '../../../KeytipData';
import { isItemDisabled, hasSubmenu, getMenuItemAriaRole } from '../../../utilities/contextualMenu/index';
import { getIsChecked, getMenuItemAriaRole, hasSubmenu, isItemDisabled } from '../../../utilities/contextualMenu/index';
import { VerticalDivider } from '../../../Divider';
import { ContextualMenuItemWrapper } from './ContextualMenuItemWrapper';
import type { IContextualMenuItem } from '../ContextualMenu.types';
Expand Down Expand Up @@ -85,6 +85,8 @@ export class ContextualMenuSplitButton extends ContextualMenuItemWrapper {
this._ariaDescriptionId = getId();
}

const ariaChecked = getIsChecked(item) ?? undefined;

return (
<KeytipData keytipProps={keytipProps} disabled={isItemDisabled(item)}>
{(keytipAttributes: any): JSX.Element => (
Expand All @@ -102,7 +104,7 @@ export class ContextualMenuSplitButton extends ContextualMenuItemWrapper {
ariaDescription ? this._ariaDescriptionId : undefined,
keytipAttributes['aria-describedby'],
)}
aria-checked={item.isChecked || item.checked}
aria-checked={ariaChecked}
aria-posinset={focusableElementIndex + 1}
aria-setsize={totalItemCount}
onMouseEnter={this._onItemMouseEnterPrimary}
Expand Down

0 comments on commit 133e4ae

Please sign in to comment.