Skip to content

Commit 1309185

Browse files
committed
fix(input): correct scroll assist clone positioning and focus handling
1 parent d21c883 commit 1309185

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

core/src/utils/input-shims/hacks/scroll-assist.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,8 +291,14 @@ const jsSetFocus = async (
291291
// give the native text input focus
292292
relocateInput(componentEl, inputEl, false, scrollData.inputSafeY);
293293

294-
// ensure this is the focused input
295-
setManualFocus(inputEl);
294+
/**
295+
* If focus has moved to another element while scroll assist was running,
296+
* don't steal focus back. This prevents focus jumping when users
297+
* quickly switch between inputs or tap other elements.
298+
*/
299+
if (document.activeElement === inputEl) {
300+
setManualFocus(inputEl);
301+
}
296302

297303
/**
298304
* When the input is about to be blurred

0 commit comments

Comments
 (0)