Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mobile devices are zooming in when focusing inputs because inputs use less than a 16px font-size #540

Open
lloydowen opened this issue Oct 25, 2024 · 1 comment

Comments

@lloydowen
Copy link

lloydowen commented Oct 25, 2024

Hey,

Not really a bug as such, but a design choice. Safari for iOS (and other browsers) will natively try and zoom the viewport if the font size of an input is less than 16px. Flux by default has a small input text size.

It's generally a bad idea to set the viewport max size preventing zooming, as a temporary measure i've added the following to my app.css.

 @media (max-width: 768px) {
        [type='text']:focus,
        input:where(:not([type])):focus,
        [type='email']:focus,
        [type='url']:focus,
        [type='password']:focus,
        [type='number']:focus,
        [type='date']:focus,
        [type='datetime-local']:focus,
        [type='month']:focus,
        [type='search']:focus,
        [type='tel']:focus,
        [type='time']:focus,
        [type='week']:focus,
        [multiple]:focus,
        textarea:focus,
        input::placeholder,
        textarea::placeholder,
        select:focus {
            font-size: 16px;
        }
    }

It would be nice to have an official fix/answer for this.

Thanks

@calebporzio calebporzio changed the title Input viewport zoom on mobile Mobile devices are zooming in when focusing inputs because inputs use less than a 16px font-size Oct 27, 2024
@calebporzio
Copy link
Contributor

Yeah, this is a valid report. I've thought about this. I'll have to try out your solution. I know other libraries change the input font size on mobile widths so that this doesn't happen, but that requires tweaking lots of other layouts to support the bigger font size. It's not really a simple fix.

I'm going to leave this open as something we'd like to tackle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants