Skip to content

Commit 66c5dd1

Browse files
committed
fix(core): fix mobile input blur on touchstart on different input
fixes #7728
1 parent cc3dda3 commit 66c5dd1

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/core/events/onTouchMove.mjs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,14 @@ export default function onTouchMove(event) {
7676
return;
7777
}
7878
}
79-
79+
if (
80+
document.activeElement &&
81+
document.activeElement.matches(data.focusableElements) &&
82+
document.activeElement !== e.target &&
83+
e.pointerType !== 'mouse'
84+
) {
85+
document.activeElement.blur();
86+
}
8087
if (document.activeElement) {
8188
if (e.target === document.activeElement && e.target.matches(data.focusableElements)) {
8289
data.isMoved = true;

src/core/events/onTouchStart.mjs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,13 @@ export default function onTouchStart(event) {
134134
data.isTouched = false;
135135
}
136136
}
137+
137138
if (
138139
document.activeElement &&
139140
document.activeElement.matches(data.focusableElements) &&
140-
document.activeElement !== targetEl
141+
document.activeElement !== targetEl &&
142+
(e.pointerType === 'mouse' ||
143+
(e.pointerType !== 'mouse' && !targetEl.matches(data.focusableElements)))
141144
) {
142145
document.activeElement.blur();
143146
}

0 commit comments

Comments
 (0)