Skip to content

Commit d8207dc

Browse files
committed
fix: prevent zoom in input on Iphone
1 parent 83040a3 commit d8207dc

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

adminforth/spa/src/afcl/Input.vue

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
@input="$emit('update:modelValue', type === 'number' ? Number(($event.target as HTMLInputElement)?.value) : ($event.target as HTMLInputElement)?.value)"
1616
:value="modelValue"
1717
aria-describedby="helper-text-explanation"
18-
class="afcl-input inline-flex bg-lightInputBackground border border-lightInputBorder text-lightInputText text-sm rounded-0 focus:ring-lightPrimary focus:border-lightPrimary dark:focus:ring-darkPrimary dark:focus:border-darkPrimary
18+
class="afcl-input inline-flex bg-lightInputBackground border border-lightInputBorder rounded-0 focus:ring-lightPrimary focus:border-lightPrimary dark:focus:ring-darkPrimary dark:focus:border-darkPrimary
1919
blue-500 focus:border-blue-500 block w-20 p-2.5 dark:bg-darkInputBackground dark:border-darkInputBorder placeholder-lightInputPlaceholderText dark:placeholder-darkInputPlaceholderText dark:text-darkInputText translate-y-0"
20-
:class="{'rounded-l-md': !$slots.prefix && !prefix, 'rounded-r-md': !$slots.suffix && !suffix, 'w-full': fullWidth}"
20+
:class="{'rounded-l-md': !$slots.prefix && !prefix, 'rounded-r-md': !$slots.suffix && !suffix, 'w-full': fullWidth, 'text-base': isIOSDevice, 'text-sm': !isIOSDevice }"
2121
:disabled="readonly"
2222
>
2323

@@ -36,6 +36,7 @@
3636
<script setup lang="ts">
3737
3838
import { ref } from 'vue';
39+
const isIOSDevice = isIOS();
3940
4041
const props = defineProps<{
4142
type: string,
@@ -52,5 +53,12 @@ defineExpose({
5253
focus: () => input.value?.focus(),
5354
});
5455
56+
function isIOS() {
57+
return (
58+
/iPad|iPhone|iPod/.test(navigator.userAgent) ||
59+
(navigator.userAgent.includes('Mac') && 'ontouchend' in document)
60+
)
61+
}
62+
5563
</script>
5664

0 commit comments

Comments
 (0)