@ndlib/component-library 1.0.13 → 1.0.14

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.
@@ -246,30 +246,34 @@ export const MenuProvider = ({ menu, children, }) => {
246
246
  }
247
247
  }, onMouseDown: () => {
248
248
  checkMidclickProps.onMouseDown();
249
- }, onClick: () => {
249
+ const menuItem = getMenuItem(path);
250
+ if ((menuItem === null || menuItem === void 0 ? void 0 : menuItem.action.type) === MENU_ACTION_TYPE.LINK) {
251
+ window.location.href = menuItem.action.to;
252
+ }
253
+ }, onClick: (e) => {
250
254
  const menuItem = getMenuItem(path);
251
255
  const isSubmenu = (menuItem === null || menuItem === void 0 ? void 0 : menuItem.action.type) === MENU_ACTION_TYPE.SUBMENU;
252
- if (isSubmenu) {
253
- if (isActivePath &&
254
- isTopLevel &&
255
- !isMidKeyPress.current &&
256
- isOpen) {
257
- close();
258
- }
259
- else if (isTopLevel &&
260
- !isMidKeyPress.current &&
261
- (!isOpen || !isActivePath)) {
262
- setActivePath(path);
263
- open();
264
- }
265
- else {
266
- onKeyDown({
267
- key: KEY_CODES.ENTER,
268
- });
269
- }
256
+ if (!isSubmenu) {
257
+ e.preventDefault();
270
258
  }
271
- else if ((menuItem === null || menuItem === void 0 ? void 0 : menuItem.action.type) === MENU_ACTION_TYPE.LINK) {
272
- window.location.href = menuItem.action.to;
259
+ if (isSubmenu &&
260
+ isActivePath &&
261
+ isTopLevel &&
262
+ !isMidKeyPress.current &&
263
+ isOpen) {
264
+ close();
265
+ }
266
+ else if (isSubmenu &&
267
+ isTopLevel &&
268
+ !isMidKeyPress.current &&
269
+ (!isOpen || !isActivePath)) {
270
+ setActivePath(path);
271
+ open();
272
+ }
273
+ else {
274
+ onKeyDown({
275
+ key: KEY_CODES.ENTER,
276
+ });
273
277
  }
274
278
  }, style: styles });
275
279
  }, [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ndlib/component-library",
3
- "version": "1.0.13",
3
+ "version": "1.0.14",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "files": [
@@ -98,4 +98,4 @@
98
98
  "sanitize-html": "^2.12.1",
99
99
  "schema-dts": "^1.1.2"
100
100
  }
101
- }
101
+ }