Skip to content

Commit 29a5d0e

Browse files
authored
fix: hover is applied after closing a modal with touch in safari iOS 26 (adobe#9715)
* fix: hover is applied after closing a modal with touch in safari iOS 26 * fix tests
1 parent 8b3016c commit 29a5d0e

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

packages/@react-aria/interactions/src/useHover.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ function setGlobalIgnoreEmulatedMouseEvents() {
4545
// the distant future because a user previously touched the element.
4646
setTimeout(() => {
4747
globalIgnoreEmulatedMouseEvents = false;
48-
}, 50);
48+
}, 500);
4949
}
5050

5151
function handleGlobalPointerEvent(e: PointerEvent) {

packages/@react-aria/interactions/test/useHover.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ describe('useHover', function () {
191191
fireEvent(el, pointerEvent('pointerout', {pointerType: 'touch'}));
192192
fireEvent(el, pointerEvent('pointerup', {pointerType: 'touch'}));
193193

194-
act(() => {jest.advanceTimersByTime(100);});
194+
act(() => {jest.advanceTimersByTime(600);});
195195

196196
// Safari on iOS has a bug that fires a pointer event with pointerType="mouse" on focus.
197197
// See https://bugs.webkit.org/show_bug.cgi?id=214609.
@@ -321,7 +321,7 @@ describe('useHover', function () {
321321
let el = res.getByTestId('test');
322322
fireEvent(el, pointerEvent('pointerover', {pointerType: 'mouse'}));
323323
expect(el).toHaveAttribute('data-hovered', 'true');
324-
324+
325325
let button = res.getByRole('button');
326326
act(() => button.click());
327327
expect(button).not.toBeInTheDocument();
@@ -444,7 +444,7 @@ describe('useHover', function () {
444444
fireEvent.mouseLeave(el);
445445
fireEvent.touchEnd(el);
446446

447-
act(() => {jest.advanceTimersByTime(100);});
447+
act(() => {jest.advanceTimersByTime(600);});
448448

449449
// Safari on iOS has a bug that fires a mouse event on focus.
450450
// See https://bugs.webkit.org/show_bug.cgi?id=214609.

0 commit comments

Comments
 (0)