Skip to content

Commit 4937668

Browse files
authored
fix: only apply safari hack if we are not already focused on the target element (#2939)
1 parent 17b7903 commit 4937668

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/@react-aria/overlays/src/usePreventScroll.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,9 @@ function preventScrollMobileSafari() {
126126

127127
let onTouchEnd = (e: TouchEvent) => {
128128
let target = e.target as HTMLElement;
129-
if (target instanceof HTMLInputElement && !nonTextInputTypes.has(target.type)) {
129+
130+
// Apply this change if we're not already focused on the target element
131+
if (target instanceof HTMLInputElement && !nonTextInputTypes.has(target.type) && target !== document.activeElement) {
130132
e.preventDefault();
131133

132134
// Apply a transform to trick Safari into thinking the input is at the top of the page

0 commit comments

Comments
 (0)