@szhsin/react-menu
Advanced tools
Comparing version 4.0.0 to 4.0.1
@@ -31,6 +31,3 @@ import { forwardRef, useRef, useCallback, useImperativeHandle, Fragment, cloneElement } from 'react'; | ||
toggleMenu(false); | ||
if (e.key) setTimeout(() => { | ||
var _buttonRef$current; | ||
return (_buttonRef$current = buttonRef.current) == null ? void 0 : _buttonRef$current.focus(); | ||
}, 0); | ||
if (e.key) buttonRef.current.focus(); | ||
}, [toggleMenu]); | ||
@@ -37,0 +34,0 @@ const onKeyDown = e => { |
@@ -58,4 +58,5 @@ import { useContext, useMemo } from 'react'; | ||
case Keys.ENTER: | ||
e.preventDefault(); | ||
case Keys.SPACE: | ||
isAnchor ? e.key === Keys.SPACE && itemRef.current.click() : handleClick(e); | ||
isAnchor ? itemRef.current.click() : handleClick(e); | ||
} | ||
@@ -62,0 +63,0 @@ }; |
@@ -91,6 +91,6 @@ import { useContext, useRef, useState, useEffect, useImperativeHandle, useMemo } from 'react'; | ||
case Keys.ENTER: | ||
e.preventDefault(); | ||
case Keys.SPACE: | ||
case Keys.RIGHT: | ||
openTrigger !== 'none' && openMenu(FocusPositions.FIRST); | ||
break; | ||
} | ||
@@ -97,0 +97,0 @@ }; |
@@ -1410,6 +1410,3 @@ 'use strict'; | ||
toggleMenu(false); | ||
if (e.key) setTimeout(() => { | ||
var _buttonRef$current; | ||
return (_buttonRef$current = buttonRef.current) == null ? void 0 : _buttonRef$current.focus(); | ||
}, 0); | ||
if (e.key) buttonRef.current.focus(); | ||
}, [toggleMenu]); | ||
@@ -1541,6 +1538,6 @@ const onKeyDown = e => { | ||
case Keys.ENTER: | ||
e.preventDefault(); | ||
case Keys.SPACE: | ||
case Keys.RIGHT: | ||
openTrigger !== 'none' && openMenu(FocusPositions.FIRST); | ||
break; | ||
} | ||
@@ -1707,4 +1704,5 @@ }; | ||
case Keys.ENTER: | ||
e.preventDefault(); | ||
case Keys.SPACE: | ||
isAnchor ? e.key === Keys.SPACE && itemRef.current.click() : handleClick(e); | ||
isAnchor ? itemRef.current.click() : handleClick(e); | ||
} | ||
@@ -1711,0 +1709,0 @@ }; |
{ | ||
"name": "@szhsin/react-menu", | ||
"version": "4.0.0", | ||
"version": "4.0.1", | ||
"description": "React component for building accessible menu, dropdown, submenu, context menu and more.", | ||
@@ -50,5 +50,5 @@ "author": "Zheng Song", | ||
"devDependencies": { | ||
"@babel/core": "^7.22.1", | ||
"@babel/preset-env": "^7.22.4", | ||
"@babel/preset-react": "^7.22.3", | ||
"@babel/core": "^7.22.5", | ||
"@babel/preset-env": "^7.22.5", | ||
"@babel/preset-react": "^7.22.5", | ||
"@rollup/plugin-babel": "^6.0.3", | ||
@@ -59,9 +59,9 @@ "@rollup/plugin-node-resolve": "^15.1.0", | ||
"@types/jest": "^29.5.2", | ||
"@types/react": "^18.2.8", | ||
"@types/react": "^18.2.14", | ||
"babel-plugin-pure-annotations": "^0.1.2", | ||
"babel-plugin-transform-react-remove-prop-types": "^0.4.24", | ||
"dtslint": "^4.2.1", | ||
"eslint": "^8.42.0", | ||
"eslint": "^8.43.0", | ||
"eslint-config-prettier": "^8.8.0", | ||
"eslint-plugin-jest": "^27.2.1", | ||
"eslint-plugin-jest": "^27.2.2", | ||
"eslint-plugin-react": "^7.32.2", | ||
@@ -76,5 +76,5 @@ "eslint-plugin-react-hooks": "^4.6.0", | ||
"react-dom": "^18.2.0", | ||
"rollup": "^3.23.0", | ||
"sass": "^1.62.1", | ||
"typescript": "^5.1.3" | ||
"rollup": "^3.25.3", | ||
"sass": "^1.63.6", | ||
"typescript": "^5.1.6" | ||
}, | ||
@@ -81,0 +81,0 @@ "keywords": [ |
@@ -14,12 +14,12 @@ # React-Menu | ||
- React menu components for easy and fast web development. | ||
- Unlimited levels of submenu. | ||
- Supports dropdown, hover, and context menu. | ||
- Supports radio and checkbox menu items. | ||
- Flexible menu positioning. | ||
- Comprehensive keyboard interactions. | ||
- Unstyled components and easy [customisation](https://szhsin.github.io/react-menu/#styling). | ||
- [Optimal level support](https://github.com/reactwg/react-18/discussions/70) (level 3) of **React 18** concurrent rendering. | ||
- Supports server-side rendering. | ||
- [WAI-ARIA Authoring Practices](https://www.w3.org/WAI/ARIA/apg/patterns/menu/) compliant. | ||
- Unstyled and lightweight [(8kB)](https://bundlephobia.com/package/@szhsin/react-menu) React menu components | ||
- Unlimited levels of submenu | ||
- Supports dropdown, hover, and context menu | ||
- Supports radio and checkbox menu items | ||
- Flexible menu positioning | ||
- Comprehensive keyboard interactions | ||
- Customisable [styling](https://szhsin.github.io/react-menu/#styling) | ||
- [Level 3 support](https://github.com/reactwg/react-18/discussions/70) of React 18 concurrent rendering | ||
- Supports server-side rendering | ||
- Implements [WAI-ARIA menu](https://www.w3.org/WAI/ARIA/apg/patterns/menu/) pattern | ||
@@ -64,3 +64,3 @@ ## Install | ||
**[FAQs](docs/FAQs.md)**<br><br> | ||
Still on older versions? Please checkout our [migration guides](docs/migration/index.md). | ||
Still on an old version? Please checkout our [migration guides](docs/migration/index.md). | ||
@@ -67,0 +67,0 @@ ## License |
161564
5168