Open jlemanski1 opened 2 years ago
Hi @jlemanski1, I checked the index.html from the developer tools but I don't see the <meta
tag that you are referring to, Please check the index.html
taken from the dev tools. Let me know if I am missing anything.
Thanks
Hey @maheshmnj, thanks for the quick response. I just created a new Flutter project to test and running a web server with release mode on, the Chrome developer tools elements tab displays the following index.html:
When inspecting the page source (raw html, before any JS runs), the index.html is as follows:
That one meta tag is being read by site accessibility checkers and giving a page zoom restricted alert/warning. Hopefully this helps a little bit. Let me know if there's anything else you need from me, and thank you again!
Thanks for the info @jlemanski1, I can see the same meta tag on stable and the master channel, Leaving this issue open for further insights from the team.
\
cc: @mdebbar
user-scalable=yes
would interfere with Flutter's gesture detection. We should instead support scaling content directly in the framework. I recall seeing an issue like that, but I can't find it any more, so let's accept this one as a feature request for scaling page content.
I've implemented two-finger pinch scaling in the app in question, the bigger issue for me is that the forced user-scalable=no
does not allow for any Flutter web app to pass accessibility checkers without manual review of the app. This is notably an issue in enterprise or academic applications where their cyber-security insurance is dependent on these automated checks. Manual reporting is the current workaround but it would be ideal if Flutter web applications could pass these accessibility checkers.
Desktop browsers apparently do not respect the user-scalable=no
. IIRC, iOS Safari doesn't respect it either. It cannot be used reliably to prevent the browser's default zooming behavior.
If I use pinch-to-zoom on the flutter gallery app in Chrome or Edge on my laptop, it essentially breaks the app: Before:
After using a touch pad pinch gesture to zoom in:
So - I would say this is not just a feature request, but also a rather serious bug to be fixed.
As #107624 was closed in regards of this, I would like to ask here why this is considered a new Feature
with Prio P5 as it is a default web/browser functionality that breaks any flutter app?
It seems that the viewport is not taken into account correctly by flutter. Changes on the viewport should not trigger a reflow of the page contents but behave like a magnifying glass.
@yjbanov #107624 was closed as a duplicate of this. It can only be considered a duplicate if we relabel this as a bug (described in that issue) instead of a low prio feature request. The bug is a consequence of a large group of browsers not respecting user-scalable=no
and Flutter not handling the browser-enforced zooming correctly. It is common knowledge among web developers that the user-scalable=no
directive is not a reliable way to disable the browser's pinch zooming.
So far we've reproduced the problem illustrated by #107624 in Chrome and Firefox on Windows, using both a touch pad and a touch screen.
We believe the issue lies in Flutter relying on window.visualViewport
to determine the application width and height (see EngineFlutterWindow.computePhysicalSize
). That function only looks at the width and height properties but ignores the scale and offsets (see VisualViewport).
I am not sure why window.visualViewport
is used there instead of window.innerWidth
and window.innerHeight
, which are currently only used as a fallback.
To summarize: Flutter web should either consistently prevent browser pinch zooming or handle it correctly. Currently, it's doing neither.
Edit: fixed typo in referenced issue ID.
This definitely feels like a bug over a feature. Since I am able to pinch and zoom on any other website, it should be something that we at least have as an option to toggle for web builds of Flutter. I was testing a web application on my monitor and lacking pinch and zoom was incredibly frustrating.
Is there any progress on this issue? Maybe a temporary fix to this problem?
Hi @s-hammad-a,
As for Pinch to Zoom functionality there are a few ways of achieving it, I'd recommend starting with this widget.
That being said, as stated above, Flutter Web is currently inconsistent with preventing and/or allowing this behaviour so you will likely still run into issues. There doesn't seem to be any progress on a resolution but @HeinrichJanzing has a detailed comment concerning the probable root cause of the issue.
@jlemanski1 Thanks for the response.
I tried your recommended InteractiveViewer widget but I am facing a problem where 2 finger scroll gestures also change the zoom. Is there anyway to disable it so it only zooms for pinch gesture? I can't find any through it's properties.
@s-hammad-a @jlemanski1 hopefully there is a way to. No pinch to zoom has really been a drag for web projects. And now more companies are starting to try out Flutter for their production web applications. It seems small in the grand scope of things but it is one of those issues that make me hesitant to recommend Flutter for web even though its my favorite framework
This has become a showstopper for our company adoption. Strangely Cmd+- MacOS or Ctrl-+ on Windows Font Scale works fine for zooming.
Hello hard working developers. Just wanted to know if someone started working on this issue or any update about it?
This 'bug' or missing feature is a blocker for our company adoption as well.
We have been evaluating flutter for a project exactly 1 year ago but decided against because of this issue. One year later, we are evaluating flutter again for a different project and the issue has seen no progress at all to a solution. This is not a feature, this is an important bug that completely breaks flutter-based apps on web, and therefore is a giant blocker for any web-based flutter project, the team should consider rising its priority.
Completely agree with the other comments - we are using Flutter for a production website for the older demographic who are likely to want to zoom. We assumed this functionality would be available, so it's a huge surprise and concern that not only does it not work but that it isn't even considered a bug!
Glad to see I'm not the only one this is incredibly important to. Hopefully the Flutter team will realize the importance of this as well
This is 100% a bug because it blocks the expected default web site behaviour and has no workarounds.
Hi any progress on this issue?
Steps to Reproduce
flutter run release --web-renderer html -d web-server --web-port 8080 --web-hostname 10.0.0.209
on any Flutter Web project.Expected results: With the HTML tag
<meta name="viewport" content="width=device-width, initial-scale=.0, maximum-scale=2.0, user-scalable=yes">
in the index.html, I expect the tag to remain there for accessibility checkers.Actual results: This meta tag:
<meta flt-viewport="" name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
is generated by Flutter, overriding any attempts to set the maximum-scale or user-scalable properties. Even attempts to update this meta tag at runtime are thwarted by Flutter.This is an issue as it prevents the Flutter web app from passing accessibility checkers even if user scalability is implemented in-app via Flutter. Any help or workarounds would be greatly appreciated as Flutter is only viable for this project as the client relies on passing accessibility checkers and security scans for their institution's cyber-sec insurance, and funding.