From 1b2bfefc4f04e050deb92b019610179d0ea6d7d6 Mon Sep 17 00:00:00 2001 From: AmateurAudioDude <168192910+AmateurAudioDude@users.noreply.github.com> Date: Wed, 28 Aug 2024 00:16:48 +1000 Subject: [PATCH] Fixes for iPhone zoom on tap, and numeric keyboard --- web/js/main.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/web/js/main.js b/web/js/main.js index 1d5f649..122ca05 100644 --- a/web/js/main.js +++ b/web/js/main.js @@ -63,9 +63,24 @@ $(document).ready(function () { } }); + // Check if device is an iPhone to prevent zoom on button press + if (/iPhone|iPod|iPad/.test(navigator.userAgent) && !window.MSStream) { + const buttons = document.querySelectorAll('button'); + buttons.forEach(button => { + button.addEventListener('touchstart', function(e) { + // Prevent default zoom behavior + e.preventDefault(); + // Allow default button action after short delay + setTimeout(() => { + e.target.click(); + }, 0); + }); + }); + } + const textInput = $('#commandinput'); - textInput.on('change', function (event) { + textInput.on('change blur', function (event) { const inputValue = Number(textInput.val()); // Check if the user agent contains 'iPhone' if (/iPhone/i.test(navigator.userAgent)) {