Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unexpected dragging triggered on spinner buttons on hover in Safari. #38840

Merged
merged 4 commits into from
Feb 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions package-lock.json

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

4 changes: 4 additions & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### Bug Fix

- Fix spin buttons of number inputs in Safari ([#38840](https://github.com/WordPress/gutenberg/pull/38840))

## 19.4.0 (2022-02-10)

### Bug Fix
Expand Down
2 changes: 1 addition & 1 deletion packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"@emotion/serialize": "^1.0.2",
"@emotion/styled": "^11.6.0",
"@emotion/utils": "1.0.0",
"@use-gesture/react": "^10.2.6",
"@wordpress/a11y": "file:../a11y",
"@wordpress/compose": "file:../compose",
"@wordpress/date": "file:../date",
Expand Down Expand Up @@ -64,7 +65,6 @@
"react-colorful": "^5.3.1",
"react-dates": "^17.1.1",
"react-resize-aware": "^3.1.0",
"react-use-gesture": "^9.0.0",
"reakit": "^1.3.8",
"uuid": "^8.3.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/box-control/unit-control.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* External dependencies
*/
import { noop } from 'lodash';
import { useHover } from 'react-use-gesture';
import { useHover } from '@use-gesture/react';

/**
* Internal dependencies
Expand Down
6 changes: 2 additions & 4 deletions packages/components/src/input-control/input-field.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* External dependencies
*/
import { noop } from 'lodash';
import { useDrag } from 'react-use-gesture';
import { useDrag } from '@use-gesture/react';
import type {
SyntheticEvent,
ChangeEvent,
Expand Down Expand Up @@ -168,9 +168,6 @@ function InputField(
const dragGestureProps = useDrag< PointerEvent< HTMLInputElement > >(
( dragProps ) => {
const { distance, dragging, event } = dragProps;
// The event is persisted to prevent errors in components using this
// to check if a modifier key was held while dragging.
event.persist();
mirka marked this conversation as resolved.
Show resolved Hide resolved

if ( ! distance ) return;
event.stopPropagation();
Expand All @@ -196,6 +193,7 @@ function InputField(
{
threshold: dragThreshold,
enabled: isDragEnabled,
pointer: { capture: false },
}
);

Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/input-control/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import type {
ChangeEvent,
SyntheticEvent,
} from 'react';
import type { useDrag } from 'react-use-gesture';
import type { useDrag } from '@use-gesture/react';

/**
* Internal dependencies
Expand Down