diff --git a/resources/views/shopping-list/index.blade.php b/resources/views/shopping-list/index.blade.php index f88ea15..54fb3c2 100644 --- a/resources/views/shopping-list/index.blade.php +++ b/resources/views/shopping-list/index.blade.php @@ -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) => {