@sproutsocial/seeds-react-menu 1.10.8 → 1.10.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +8 -8
- package/CHANGELOG.md +16 -0
- package/dist/esm/index.js +45 -24
- package/dist/esm/index.js.map +1 -1
- package/dist/index.js +35 -14
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/MenuGroup/MenuGroup.tsx +16 -3
- package/src/MenuGroup/__tests__/MenuGroup.test.tsx +19 -0
- package/src/MenuItem/MenuItem.tsx +21 -10
- package/src/MenuItem/__tests__/MenuItem.test.tsx +19 -0
package/dist/index.js
CHANGED
|
@@ -475,22 +475,26 @@ var MenuItem = ({
|
|
|
475
475
|
});
|
|
476
476
|
const item = itemsMap[id] || { index: 0, id };
|
|
477
477
|
const highlighted = highlightedIndex === item?.index;
|
|
478
|
+
const downshiftItemProps = getItemProps?.({
|
|
479
|
+
...isListbox ? {} : { role: "menuitem" },
|
|
480
|
+
item,
|
|
481
|
+
index: item.index,
|
|
482
|
+
// The disabled prop no longer supported in downshift. Use isItemDisabled instead.
|
|
483
|
+
// disabled,
|
|
484
|
+
onClick,
|
|
485
|
+
onKeyDown,
|
|
486
|
+
ref: innerRef
|
|
487
|
+
}) ?? {};
|
|
488
|
+
if (!isListbox && "aria-selected" in downshiftItemProps) {
|
|
489
|
+
delete downshiftItemProps["aria-selected"];
|
|
490
|
+
}
|
|
478
491
|
return hiddenItemsMap[item.id] ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, {}) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(MenuItemContainer, { role: "none", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
479
492
|
StyledMenuItem,
|
|
480
493
|
{
|
|
481
494
|
id,
|
|
482
495
|
$highlighted: highlighted,
|
|
483
496
|
$active: active,
|
|
484
|
-
...
|
|
485
|
-
...isListbox ? {} : { role: "menuitem" },
|
|
486
|
-
item,
|
|
487
|
-
index: item.index,
|
|
488
|
-
// The disabled prop no longer supported in downshift. Use isItemDisabled instead.
|
|
489
|
-
// disabled,
|
|
490
|
-
onClick,
|
|
491
|
-
onKeyDown,
|
|
492
|
-
ref: innerRef
|
|
493
|
-
}),
|
|
497
|
+
...downshiftItemProps,
|
|
494
498
|
as: isListbox ? void 0 : href ? "a" : "button",
|
|
495
499
|
type: href ? void 0 : "button",
|
|
496
500
|
href,
|
|
@@ -919,7 +923,18 @@ var StyledMenuGroupUl = import_styled_components7.default.ul`
|
|
|
919
923
|
`;
|
|
920
924
|
|
|
921
925
|
// src/MenuGroup/MenuGroup.tsx
|
|
922
|
-
var import_jsx_runtime9 =
|
|
926
|
+
var import_jsx_runtime9 = (
|
|
927
|
+
// role="none" on the outer <li>: this wrapper is purely visual (it exists
|
|
928
|
+
// for the border-bottom divider between groups in the parent menu <ul>).
|
|
929
|
+
// The ARIA group semantics live on the inner <ul> below — axe rejects
|
|
930
|
+
// role="group" on <li>, and a native <ul> here would trigger the `list`
|
|
931
|
+
// rule because its children are <li role="none"> menuitem wrappers.
|
|
932
|
+
//
|
|
933
|
+
// TODO(DS-4273): drop the list-based DOM entirely (MenuContent/MenuGroup
|
|
934
|
+
// as <div>, no <ul>/<li>, no role="none" wrappers). This is the followup
|
|
935
|
+
// to DS-4271's minimal ARIA patch.
|
|
936
|
+
require("react/jsx-runtime")
|
|
937
|
+
);
|
|
923
938
|
var MenuGroup = ({
|
|
924
939
|
titleAs = "h3",
|
|
925
940
|
children: childrenProp,
|
|
@@ -939,15 +954,21 @@ var MenuGroup = ({
|
|
|
939
954
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
940
955
|
StyledMenuGroup,
|
|
941
956
|
{
|
|
942
|
-
role: "
|
|
957
|
+
role: "none",
|
|
943
958
|
id,
|
|
944
959
|
isSingleSelect,
|
|
945
|
-
"aria-labelledby": title ? titleId : void 0,
|
|
946
960
|
color: color5,
|
|
947
961
|
...rest,
|
|
948
962
|
children: [
|
|
949
963
|
title && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(StyledTitle, { role: "heading", as: titleAs, id: titleId, children: title }),
|
|
950
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
964
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
965
|
+
StyledMenuGroupUl,
|
|
966
|
+
{
|
|
967
|
+
role: "group",
|
|
968
|
+
"aria-labelledby": title ? titleId : void 0,
|
|
969
|
+
children
|
|
970
|
+
}
|
|
971
|
+
)
|
|
951
972
|
]
|
|
952
973
|
}
|
|
953
974
|
);
|