Skip to content

Commit

Permalink
Fix resize input focus issue when triggering resize from dropdown men…
Browse files Browse the repository at this point in the history
…u in Android Chome

due to #1513, Android Chrome would cause a premature focus shift from the resizer input to the body/whatever element was underneath the "resize column" menu option, causing resizing to end early and canceling the 2nd delayed focusInput call. We delay the first focusInput call now so that it happens after the browser delayed click on touch end
  • Loading branch information
LFDanLu committed Aug 7, 2023
1 parent a5c6977 commit 976eab9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/@react-aria/table/src/useTableColumnResize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ export function useTableColumnResize<T>(props: AriaTableColumnResizeProps<T>, st
if (prevResizingColumn.current !== resizingColumn && resizingColumn != null && resizingColumn === item.key) {
wasFocusedOnResizeStart.current = document.activeElement === ref.current;
startResize(item);
focusInput();
setTimeout(() => focusInput(), 0);
// VoiceOver on iOS has problems focusing the input from a menu.
let timeout = setTimeout(focusInput, 400);
return () => clearTimeout(timeout);
Expand Down

0 comments on commit 976eab9

Please sign in to comment.