Skip to content

Commit

Permalink
TPP 849 final touches (#317)
Browse files Browse the repository at this point in the history
* removed disabled and addd aria-hidden and remove tabbability, added testid for menu

* 3.2.23
  • Loading branch information
KitoC authored Aug 8, 2024
1 parent 1302b46 commit e738a2a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
22 changes: 15 additions & 7 deletions lib/components/ActionsMenu/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,12 +188,11 @@ export const ActionsMenuItem = styled((props) => {

const { as, ...others } = props;
const Component = as ? as : others.href ? "a" : "button";
const disabled = !actionMenu?.context?.open ?? false;
const disabled = props.disabled;

let newProps = {
...others,
...(actionMenu?.getItemProps?.() || {}),
disabled
...(actionMenu?.getItemProps?.() || {})
};

const { onClick: originalOnClick } = newProps;
Expand All @@ -210,12 +209,20 @@ export const ActionsMenuItem = styled((props) => {
newProps = {
...others,
type: "button",
["data-action-menu-id"]: id,
disabled
["data-action-menu-id"]: id
};
}

return <Component {...newProps} onClick={onClick} />;
return (
<Component
{...newProps}
onClick={onClick}
disabled={disabled}
// Hide from document when closed - related to HACK
aria-hidden={!actionMenu?.context?.open}
tabIndex={!actionMenu?.context?.open && "-1"}
/>
);
}).attrs({ role: "menuitem" })`
white-space: nowrap;
display: block;
Expand Down Expand Up @@ -269,7 +276,7 @@ export const ActionsMenuBody = ({
onTriggerFocus,
closeMenu,
closeOnClick = false,
"data-testid": dataTestId,
"data-testid": dataTestId = "ActionsMenu",

Check warning on line 279 in lib/components/ActionsMenu/index.js

View workflow job for this annotation

GitHub Actions / build

'data-testid' is missing in props validation
...props
}) => {
const id = useId();
Expand Down Expand Up @@ -341,6 +348,7 @@ export const ActionsMenuBody = ({
{...actionMenu.getFloatingProps(props)}
className={`actionMenu-content ${visible ? "visible" : ""}`}
aria-hidden={visible ? "false" : "true"}
data-testid={`${dataTestId}__menu`}
>
<Menu menuWidth={menuWidth} isOpen={toggleState}>
{children}
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "orcs-design-system",
"version": "3.2.22",
"version": "3.2.23",
"engines": {
"node": "20.12.2"
},
Expand Down

0 comments on commit e738a2a

Please sign in to comment.