-
-
Notifications
You must be signed in to change notification settings - Fork 889
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
Accessibility and scaling #308
Comments
I've done some investigation here, and it looks like it has something to with how Flutter handles rich text. For example, as a hack, if I temporarily change this library's flutter_html/lib/html_parser.dart Line 719 in 6a8e58b
Similarly, if I slightly modify the above program to add a third row containing:
|
Same thing is happening with me |
Did a bit more digging on this today and found this helpful comment from one of the key flutter folk: flutter/flutter#14675 (comment) So, it looks like trying to render a Clearly, though, there is some tension in this case though, because of the ability in this library to provide "css" overrides. However, it feels like we should still be able to apply the style settings and then allow flutter to apply the platform's scaling on top of that. Still investigating... |
Alright. I know what's going on here... the underlying problem is that the current scale factor gets applied multiple times because the tree recursively creates I've got a hacky fix and will push up a PR shortly once I've tidied it up. |
@edwardaux Thank you very much for your contribution. I've been quite busy recently and haven't been able to take a look at this |
I need this ASAP. 😜 |
In Flutter, https://api.flutter.dev/flutter/widgets/Text-class.html |
I think we are getting caught up in a flutter text defect. I have an isolated case captured here https://stackoverflow.com/questions/62189595/scaling-nested-richtext-widgets-for-accessibility (I was hoping someone might have some ideas) but I’m about to raise a ticket in the flutter repo. |
@edwardaux @ryan-berger I have downgraded Flutter to 1.12.13+hotfix.6 and checkout older version of my app (since I upgraded lots of code and dependencies for Flutter 1.17 since then) and Voila, it works! First screenshot is Flutter 1.12.13+hotfix.6 with flutter_html v1.0.0-pre.1 and second screenshot is the Flutter 1.17+ with flutter_html v1.0.0. I have then recompiled my old code keeping flutter_html 1.0.0-pre.1 with flutter 1.17.3, and fonts are messed up again. I'm not sure does this help our case, but it looks like they have changed something in RichText from 1.12 to 1.17 |
@edwardaux @mileusna Yeah definitely sounds like a Flutter issue. I'm quite busy this week as I am starting a new job and moving, but if I find some time I can take a look at the changelogs and see if I can find anything. @edwardaux If you think that it is for sure an issue that can't be fixed through the update to the RichText API, by all means open a flutter ticket, and if a fix comes out we can try to make a shim so we can have it before the next release. |
Ah, well spotted @mileusna! I ha a very quick look at the diff between those two specific releases, but nothing jumped out at me. I'll try to find some time tomorrow to step through the releases and find the one where it breaks. |
I have the same issue that text wrapped in Html() its not resposive in IOS user text scale. |
@edwardaux I took a look at the changelog, and there was a change directly related to Here's that link to the PR in question: flutter/flutter#48346 |
@mileusna @ryan-berger I finally had a chance to poke around using older versions of flutter today. I have a pretty isolated test case (totally independent of flutter_html) that I have been using for my investigations. Interestingly, it is also broken in 1.12.13+hotfix.6. If I compare Anyway, given that I can easily reproduce the same symptoms using Flutter primitive widgets, I've raised flutter/flutter#59316 to see what the Flutter-folk say. |
i was becoming fan of this package but unfortunately now i am using webview and rendering local html string |
WebView can't display large HTML, so I'm still a fan of this widget. Hopefully, this bug with RichText will sort out. |
I created local copy of html_view and add
|
@ryan-berger So I've heard back from the Flutter team about the underlying problem. It looks like the expected behaviour if you nest Right now, though, this is an immediate fix that will fix the scaling. However, it does introduce a wrapping problem... which is a bug in the current Flutter SDK (see flutter/flutter#59711). As far as I can see, there's no real workaround until that fix lands. Given that the current scaling bug doesn't wrap properly either, it is probably still worth fixing the scale factor in this library so that it is ready when that fix lands. I'll submit a PR shortly. |
Instead of 1.0 you'd better fix it to MediaQuery's textScaleFactor though. Or would that break again? |
all of the inner scale factors should be set to 1.0, but then a new wrapper around everything needs to be added that contains the |
Any updates on this already? |
this actually works until there is a proper fix |
Hi @ThuAbLKA / @ghecreagheorghe, Thanks |
Hi @saptha ,
|
Thanks @ThuAbLKA for the explanation. I followed it and got it worked. |
If you are not care about the font scale from the ROM settings, you can use the workaround below: just wrap your widget in a MediaQuery which will force reset the textScaleFactor to 1.0 MediaQuery(
data: MediaQuery.of(context).copyWith(textScaleFactor: 1.0),
child: child,
); Absolutely, this is not a resolution for this plugin. |
I see that the related pull request has relanded successfully in Flutter framework: flutter/flutter#63118 Interesting when it will make its way to stable... Does anyone know how to monitor that? |
I would guess flutter/flutter#63118 lands in Flutter 1.22.0 |
Shouldn't this Issue be left open until the issue is fixed and verified? I searched open issues before opening my own copy of this issue since I couldn't find any. Exited to see Flutter 1.22.0 land! |
This is fixed with Flutter 1.22 |
I can confirm, works for me too with 1.22! 🎉 |
I'm having this same issue again on flutter_html 3.0.0-alpha.6 |
Same issue for me too with Flutter 3.3.10 |
When applying the system accessibility size settings, the text in a
Html
widget gets scaled way more than a normalText
widget. Consider the following code:When you scale the text using iOS accessibility settings, you see the following:
I mentioned this in #303 but I thought it might be worth having it's own ticket (they may end up being related).
The text was updated successfully, but these errors were encountered: