Skip to content

Commit

Permalink
fix(core): fix mobile input blur on touchstart on different input
Browse files Browse the repository at this point in the history
fixes #7728
  • Loading branch information
nolimits4web committed Sep 12, 2024
1 parent cc3dda3 commit 66c5dd1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
9 changes: 8 additions & 1 deletion src/core/events/onTouchMove.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,14 @@ export default function onTouchMove(event) {
return;
}
}

if (
document.activeElement &&
document.activeElement.matches(data.focusableElements) &&
document.activeElement !== e.target &&
e.pointerType !== 'mouse'
) {
document.activeElement.blur();
}
if (document.activeElement) {
if (e.target === document.activeElement && e.target.matches(data.focusableElements)) {
data.isMoved = true;
Expand Down
5 changes: 4 additions & 1 deletion src/core/events/onTouchStart.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,13 @@ export default function onTouchStart(event) {
data.isTouched = false;
}
}

if (
document.activeElement &&
document.activeElement.matches(data.focusableElements) &&
document.activeElement !== targetEl
document.activeElement !== targetEl &&
(e.pointerType === 'mouse' ||
(e.pointerType !== 'mouse' && !targetEl.matches(data.focusableElements)))
) {
document.activeElement.blur();
}
Expand Down

0 comments on commit 66c5dd1

Please sign in to comment.