Fix iPhone-Fokus nach Hinzufuegen.
Setzt den Fokus auf iOS robuster ueber mehrere Trigger und Fallback ohne preventScroll, damit das Feld Neuer Eintrag nach Redirect wieder aktiv ist. Made-with: Cursor
This commit is contained in:
parent
b9e8b495b7
commit
d152af316c
@ -374,8 +374,25 @@
|
||||
if (!input) {
|
||||
return;
|
||||
}
|
||||
input.focus({ preventScroll: true });
|
||||
input.select();
|
||||
const applyFocus = () => {
|
||||
try {
|
||||
input.focus({ preventScroll: true });
|
||||
} catch (_e) {
|
||||
input.focus();
|
||||
}
|
||||
try {
|
||||
input.select();
|
||||
} catch (_e) {
|
||||
// no-op
|
||||
}
|
||||
};
|
||||
|
||||
// iOS Safari ist bei Fokus nach Redirect empfindlich; daher mehrfach anstossen.
|
||||
applyFocus();
|
||||
requestAnimationFrame(applyFocus);
|
||||
setTimeout(applyFocus, 120);
|
||||
setTimeout(applyFocus, 420);
|
||||
window.addEventListener('pageshow', applyFocus, { once: true });
|
||||
});
|
||||
|
||||
document.addEventListener('click', async (event) => {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user