-
Notifications
You must be signed in to change notification settings - Fork 3.2k
feat: Disable Auto zoom on text input for iphone #8001
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
Comments
Great point! Do we really need to check for the device type or can't we just apply maximum-scale=1 all the time? what would be the impact? Agree the app is almost un-usable on iOS because of this. Also the fact that you have to click twice on chip/cell is frustrating on mobile. |
/award 100 |
Awarding harshit078: 100 points 🕹️ Well done! Check out your new contribution on oss.gg/harshit078 |
|
I actually think disabling the pinch-to-zoom would be nice as it's something you do on the web but not something you do on an app so it could help give a more "native" feeling. I agree we could consider changing fonts and more but I guess that would be part of a bigger redesign, we discussed it with @Bonapara but said it wouldn't be for short-term |
@FelixMalfait But this would still give the access to pinch in and out for ios users ? |
I think we could add |
|
@harshit078 yes I think it's great that it disables zoom on mobile, a native mobile app doesn't allow you to zoom Also we should remove the :hover on mobile (not with the script that blindly replaces everything given in the article but by targeting the few places where the :hover really annoying and doing it in the styled component) |
@FelixMalfait I agree to your point on removing hover for mobile viewports\ |
Turning off zooming harms accessibility, and I think we must avoid it. See https://www.boia.org/blog/web-accessibility-tips-do-no-disable-zooming-yes-even-on-mobile. To circumvent iOS's auto zoom-in on focused inputs, I often see people setting a default 14px size on desktop and 16px on mobile. I understand that making global CSS changes is not easy. We can think about quick wins. |
@Devessier I agree to your point. Making |
See also:
I think accessibility on mobile is not a priority at this point as we need to fix accessibility on desktop first, and have a basic working app on mobile first (the auto-focus makes it unusable in its current auto-focus state right now, even for non-disabled users) |
That's great that you brought all these issues to the table, @harshit078. I may lack context, so feel free to share previous discussions with me 😄 Prevent iOS from automatically zooming inI'm on iOS 16.7 – yes, I know... – and I tried to update the viewport meta to what you suggested: <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=none"> It prevents the browser from automatically zooming in when an input is focused, but I'm still able to zoom in and out, which was my concern. From a UX and accessibility point of view, we can go with this solution specifically for iOS browsers, provided we test it on more recent iOS versions. RPReplay_Final1730223490.MP4Technically, I tested the function I would either put it inside a We should double-check the condition we'll use to apply this configuration. Usually, relying on user agents is unsafe. It might be the best option we have. Prevent hover styles on mobileThere are media queries to detect whether the current device supports hovering. I would prefer using them instead of relying on a viewport media query. See https://www.smashingmagazine.com/2022/03/guide-hover-pointer-media-queries/. Prevent necessary double-clicking to edit table cellsWe can work on solving this rather dull issue. Has it already been discussed somewhere? I would love to check that. |
Hey thanks @Devessier! could you please raise a quick PR with pragmatic/simple fixes based on what your think is best? |
So should we just?
That should be solved by removing the hover |
@Devessier could you please check if the ability to zoom in-out manually is there for android devices when using - |
I disagree with the BOIA article. There are accessibility tools like VoiceOver on mobile that are purposely made for the native experience. Native apps, even the official one like for example the play store, don't allow "pinch to zoom". So I don't think we absolutely have to allow it if we can avoid it. There will be other ways to make the app more accessible that won't hurt the experience for all (as you say we can later work on a larger font, etc.) |
Native apps and websites have different expected UX. I don't know much about accessibility on native mobile applications, but I assume that there are device settings to circumvent the impossibility of zooming in. Being able to zoom in is a requirement for many people, so there is necessarily an option for them to do so. Furthermore, I think Apple reviewers take care of testing accessibility essential criteria. The Web platform offers way more freedom—and that's awesome—but it's also easy to be harmful. My rule of thumb is to be careful when overriding a browser's default behavior. Disallowing zoom-in is considered a bad practice, and I often find myself zooming in on websites, so I'm a bit reluctant to this idea. We can settle on the less destructive option. It seems that the viewport setting mentioned above doesn't prevent zooming on iOS while fixing the original zooming bug when the user focuses an input. We should triple-check that it works properly on other people's iPhones. Adding it only to iOS, even though that's hacky, could be our best temporary solution. I understand the urge to improve mobile UX, but introducing a bad practice should only be acceptable if we minimize its impact and are all okay that we will have to refactor it. |
@FelixMalfait, you want to fully remove the pinch to zoom? Not just deactivate the "auto-zoom"? |
I would like to add one more point to this discussion is that following the recent trend, iPads have replaced many laptops and are the main machine for many users. Targeting both iPhone and specially iPad is crucial as having to zoom in and out on a large device screen is essential for better readability from a general perspective. |
It is also seen that wherever DropdownMenuSearchInput is used, there is no auto zoom to the text input field. However DropdownMenuSearchInput uses ScreenRecording_11-08-2024.13-15-34_1.MP4 |
Thanks for your research, @harshit078. I suggest setting a max zoom only for iOS devices to move on this issue. This setting isn't causing accessibility issues but fixes the unwanted zoom effect. I can propose a PR to implement it in the upcoming days. |
I suggested a change here for the iOS auto zoom: #8477. We mentioned the bug on iOS that makes it necessary to click twice on a RecordTable cell to open it. I created a separate issue to track this bug: twentyhq/core-team-issues#178. |
This is the result of a long discussion we had here: #8001. The goal is to stop iOS from automatically zooming when the user focuses on an input whose font size is less than 16px. The options were: 1. Disable zoom for all devices 2. Disable zoom for devices detected as iOS devices, which doesn't prevent users from zooming manually but fixes the auto-zoom bug 3. Set the font size of the inputs to be equal to or greater than 16px—this change would take a lot of time To me, the second option is the best, as iOS prevents developers from disabling zoom. They saw that it was overused and chose to restrict this setting. Setting a `maximum-scale` doesn't prevent users from zooming, but it fixes the initial bug we had. My implementation can be seen as [progressive enhancement](https://developer.mozilla.org/en-US/docs/Glossary/Progressive_Enhancement ): If we can detect that the user uses an iOS device, we'll set the `maximum-scale` viewport property. Relying on the user agent is always unstable, and the check might fail unpredictably. We might not disallow auto-zoom for some iOS devices. However, I think we can either: - Invest some time to choose a more reliable user detection pattern if the one I suggest is not sufficient ([we find many different checks on the internet](https://stackoverflow.com/questions/9038625/detect-if-device-is-ios), I'm not sure which one is the best) - Choose to apply the viewport setting to all devices and remove the JS code. According to my tests, it doesn't prevent zooming on desktops. However, it does on Android phones. I think it's not lovely to disallow zoom, but if the team agrees that we should go this way, I won't disagree. I know my JavaScript code does not follow a pattern we want to spread in the app. The synchronous script will run as soon as possible to ensure the viewport is correctly set when the website launches. This shouldn't be an example followed by others. Thanks, @harshit078, for your help in thinking about the best option. I'm tagging @lucasbordeau and @charlesBochet for a technical review. I would appreciate if someone could test on a more recent iOS device than mine. Here is a demonstration of the behavior on iOS: https://github.com/user-attachments/assets/d49fb65f-dd76-455c-9ac0-d4c002a7fe89
Current behavior
ScreenRecording_10-21-2024.00-58-06_1.MP4
ScreenRecording_10-21-2024.01-00-13_1.mov
ScreenRecording_10-21-2024.09-59-03_1.MP4
Expected behavior
There should be no auto zoom when typing in a input field and the user should have the ability to zoom itself. Currently the user has to zoom out everytime he has interacted with an input field.
Dropdown menu should not clip through RightDrawer and should close when opening RightDrawer
When editing, the page should avoid scrolling to the end and stay at its current position.
Proposals
maximum-scale=1
property which prevents this behaviour. This behaviour doesn't happen on android and is only limited to ios.Disable the use of AutoFocus- We are currently using Autofocus in a lot of text inputs in our code which focus on input field while editing making it easier for user. Ios makes it more accessible by auto zooming in the input field for ease of convience.
Font Size- We are currently using
font-size: ${({ theme }) => theme.font.size.sm};
in a lot of places along with16px
in some places. One of the major reasons for auto zoom in ios is the font size being smaller than14px
. By allowing16px
to be the standard font across all the webapp, it would significantly contribute to this issue.The text was updated successfully, but these errors were encountered: