Skip to content

Commit

Permalink
lower timeout to 60ms
Browse files Browse the repository at this point in the history
  • Loading branch information
yihuiliao committed Feb 5, 2025
1 parent d332979 commit 8969816
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/@react-aria/interactions/src/usePress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ export function usePress(props: PressHookProps): PressResult {
state.target.click();
}
}
}, 80);
}, 60);
// Use a capturing listener to track if a click occurred.
// If stopPropagation is called it may never reach our handler.
addGlobalListener(e.currentTarget as Document, 'click', () => clicked = true, true);
Expand Down
4 changes: 2 additions & 2 deletions packages/@react-aria/interactions/test/usePress.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ describe('usePress', function () {
expect(shouldFocus).toBe(true);

// Mouse events are not fired in this case, and the browser does not focus the element.
act(() => jest.advanceTimersByTime(90));
act(() => jest.advanceTimersByTime(70));
expect(document.activeElement).toBe(el);

expect(events).toEqual([
Expand Down Expand Up @@ -352,7 +352,7 @@ describe('usePress', function () {
expect(shouldClick).toBe(true);
fireEvent(el, pointerEvent('pointerout', {pointerId: 1, pointerType: 'mouse', clientX: 0, clientY: 0}));

act(() => jest.advanceTimersByTime(90));
act(() => jest.advanceTimersByTime(70));

expect(events).toEqual([
{
Expand Down

2 comments on commit 8969816

@rspbot
Copy link

@rspbot rspbot commented on 8969816 Feb 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rspbot
Copy link

@rspbot rspbot commented on 8969816 Feb 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.