fix: Clicking dropdown menu items in FF (#2269)
* fix: Clicking dropdown menu items in FF closes #2264 * fix: Anchor items, add comment * fix: CI test memory issues
This commit is contained in:
parent
f65469b777
commit
286a15cf10
|
@ -26,16 +26,18 @@ const MenuItem = ({
|
||||||
hide,
|
hide,
|
||||||
...rest
|
...rest
|
||||||
}: Props) => {
|
}: Props) => {
|
||||||
const handleClick = React.useCallback(
|
// We bind to mousedown instead of onClick here as otherwise menu items do not
|
||||||
|
// work in Firefox which triggers the hideOnClickOutside handler first via
|
||||||
|
// mousedown.
|
||||||
|
const handleMouseDown = React.useCallback(
|
||||||
(ev) => {
|
(ev) => {
|
||||||
if (onClick) {
|
if (onClick) {
|
||||||
|
ev.preventDefault();
|
||||||
|
ev.stopPropagation();
|
||||||
onClick(ev);
|
onClick(ev);
|
||||||
}
|
}
|
||||||
if (hide) {
|
|
||||||
hide();
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
[hide, onClick]
|
[onClick]
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -50,7 +52,8 @@ const MenuItem = ({
|
||||||
{...props}
|
{...props}
|
||||||
$toggleable={selected !== undefined}
|
$toggleable={selected !== undefined}
|
||||||
as={onClick ? "button" : as}
|
as={onClick ? "button" : as}
|
||||||
onClick={handleClick}
|
onMouseDown={handleMouseDown}
|
||||||
|
onClick={hide}
|
||||||
>
|
>
|
||||||
{selected !== undefined && (
|
{selected !== undefined && (
|
||||||
<>
|
<>
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
"db:rollback": "sequelize db:migrate:undo",
|
"db:rollback": "sequelize db:migrate:undo",
|
||||||
"upgrade": "git fetch && git pull && yarn install && yarn heroku-postbuild",
|
"upgrade": "git fetch && git pull && yarn install && yarn heroku-postbuild",
|
||||||
"test": "yarn test:app && yarn test:server",
|
"test": "yarn test:app && yarn test:server",
|
||||||
"test:app": "jest --config=app/.jestconfig.json",
|
"test:app": "jest --config=app/.jestconfig.json --runInBand --forceExit",
|
||||||
"test:server": "jest --config=server/.jestconfig.json --runInBand --forceExit",
|
"test:server": "jest --config=server/.jestconfig.json --runInBand --forceExit",
|
||||||
"test:watch": "jest --config=server/.jestconfig.json --runInBand --forceExit --watchAll"
|
"test:watch": "jest --config=server/.jestconfig.json --runInBand --forceExit --watchAll"
|
||||||
},
|
},
|
||||||
|
@ -140,7 +140,7 @@
|
||||||
"react-virtualized-auto-sizer": "^1.0.5",
|
"react-virtualized-auto-sizer": "^1.0.5",
|
||||||
"react-waypoint": "^10.1.0",
|
"react-waypoint": "^10.1.0",
|
||||||
"react-window": "^1.8.6",
|
"react-window": "^1.8.6",
|
||||||
"reakit": "^1.3.6",
|
"reakit": "^1.3.8",
|
||||||
"regenerator-runtime": "^0.13.7",
|
"regenerator-runtime": "^0.13.7",
|
||||||
"rich-markdown-editor": "^11.13.0",
|
"rich-markdown-editor": "^11.13.0",
|
||||||
"semver": "^7.3.2",
|
"semver": "^7.3.2",
|
||||||
|
|
|
@ -11228,10 +11228,10 @@ reakit-warning@^0.6.1:
|
||||||
dependencies:
|
dependencies:
|
||||||
reakit-utils "^0.15.1"
|
reakit-utils "^0.15.1"
|
||||||
|
|
||||||
reakit@^1.3.6:
|
reakit@^1.3.8:
|
||||||
version "1.3.6"
|
version "1.3.8"
|
||||||
resolved "https://registry.yarnpkg.com/reakit/-/reakit-1.3.6.tgz#0a58a1b5ba839b24cf722a5816efe72dc2240e7f"
|
resolved "https://registry.yarnpkg.com/reakit/-/reakit-1.3.8.tgz#717e1a3b7cc6da803362a0edc2c55d2b6a001baf"
|
||||||
integrity sha512-/I7XNPEUuRjCVwDkriy7HKuSKTtCmojZrrClGIg1gexB7Ij5vjpEbyUZzwHMmvIEoMqUZDC0Q6cDWfLpqaY9vA==
|
integrity sha512-8SVejx6FUaFi2+Q9eXoDAd4wWi/xAn6v8JgXH8x2xnzye8pb6v5bYvegACVpYVZnrS5w/JUgMTGh1Xy8MkkPww==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@popperjs/core" "^2.5.4"
|
"@popperjs/core" "^2.5.4"
|
||||||
body-scroll-lock "^3.1.5"
|
body-scroll-lock "^3.1.5"
|
||||||
|
|
Reference in New Issue