Skip to content

Commit 5a44a51

Browse files
authored
iOS autocomplete double click fix (#1101)
1 parent a8add99 commit 5a44a51

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

resources/js/vue-components.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,19 @@ document.addEventListener('vue:loaded', function (event) {
6464
}),
6565
}),
6666
)
67+
if (import.meta.env.VITE_DISABLE_DOUBLE_CLICK_FIX !== 'true') {
68+
document.addEventListener('vue:loaded', function () {
69+
// Workaround double click bug on ipad & iphone: https://stackoverflow.com/questions/71535540/keyboard-doesnt-open-in-ios-on-focus
70+
if (
71+
['iPad Simulator', 'iPhone Simulator', 'iPod Simulator', 'iPad', 'iPhone', 'iPod'].includes(navigator.platform) ||
72+
(navigator.userAgent.includes('Mac') && 'ontouchend' in document)
73+
) {
74+
// Simply load the autocomplete ~600ms after pageload so it won't impact pageload but will
75+
// Be fast enough that most users won't notice
76+
setTimeout(() => window.document.dispatchEvent(new window.Event('loadAutoComplete')), 600)
77+
}
78+
})
79+
}
6780
vue.component(
6881
'checkout-login',
6982
defineAsyncComponent(() => import('./components/Checkout/CheckoutLogin.vue')),

0 commit comments

Comments
 (0)