Repository navigation
Update RichText semantics when only TextSpan semantics fields change - #195756
Draft
ChandraChaan wants to merge 3 commits into
Draft
ChandraChaan wants to merge 3 commits into
ChandraChaan wants to merge 3 commits into
Conversation
TextSpan.compareTo ignored semanticsLabel, semanticsIdentifier, locale and spellOut, so RenderParagraph kept the old semantics when only those changed. The metadata branch of RenderParagraph.text also kept the cached attributed labels. TextSpan == and hashCode now include locale and spellOut.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When only
semanticsLabel,semanticsIdentifier,localeorspellOutof aTextSpanchanges,RichTextkeeps the old semantics, so a screen reader announces the stale label or locale.There are two causes:
TextSpan.compareToonly checksrecognizerfor metadata changes, so it returnsRenderComparison.identicalandRenderParagraph.textreturns early. It now returnsmetadatawhen any of those four fields differ.metadatabranch ofRenderParagraph.textdidn't clear_cachedAttributedLabels, which is where the label is built from. It now clears it, like thepaintandlayoutbranches.TextSpan.==andhashCodealso ignoredlocaleandspellOut; they now include them.Tests:
compareToand equality unit tests intext_span_test.dart, and a widget test inrich_text_test.dartthat changes the label and then the locale. All three fail without this change. Locally,test/paintingandtest/renderingpass apart from thelocalized_fonts_test.dartgoldens, which show the same few-pixel differences on a clean checkout.Fixes #195755
Pre-launch Checklist
///).