Repository navigation
Description
Current behavior 🐛
Changing TextBox.IsSpellCheckEnabled at runtime does not refresh the spell-check underlines. The previously computed squiggles stay on screen (or stay absent) until something unrelated happens to invalidate the text block's measure.
The property change does reach the display block, but nothing re-runs the text parse that computes the corrections:
TextBox.IsSpellCheckEnabledProperty's changed callback callsTextBoxCore.OnIsSpellCheckEnabledChanged—TextBox.cs:491-499. The metadata is plainFrameworkPropertyMetadatawith noAffectsMeasure.OnIsSpellCheckEnabledChangedPartialassignsTextBoxView.DisplayBlock.IsSpellCheckEnabled = newValueand then callsTextBoxView.UpdateProperties()—TextBoxCore.Input.cs:301-308.TextBlock.IsSpellCheckEnabledis a plain auto-property with no invalidation —TextBlock.cs:1427.TextBoxView.UpdateProperties()is=> _overlayTextBoxViewExtension?.UpdateProperties();—TextBoxView.cs:207. It only forwards to the native input overlay and never touches the display block's layout.
So nothing calls InvalidateMeasure / InvalidateTextBlock on the display block. The value is only consumed inside the UnicodeText constructor, which recomputes _corrections from the spell-checking service — so the underlines only change on the next re-parse, which happens for some other reason entirely.
Expected behavior 🎯
Toggling IsSpellCheckEnabled should take effect immediately: turning it off clears the underlines, turning it on computes and draws them.
How to reproduce it (as minimally and precisely as possible) 🔬
This needs the SpellChecking UnoFeature enabled, since without a registered ISpellCheckingService no corrections are computed at all and the symptom is invisible.
- Create an Uno Platform app with the
SpellCheckingfeature, targeting Desktop (Skia). - Put a
TextBoxon the page withIsSpellCheckEnabled="True"and type text containing a misspelling, so underlines appear. - From a button, set
textBox.IsSpellCheckEnabled = false;.
Observed: the underlines remain.
Expected: they disappear.
The reverse direction is stale in the same way — starting with IsSpellCheckEnabled="False", setting it to true at runtime does not produce underlines.
Note that anything which happens to dirty the text block's measure afterwards (typing another character, resizing the window, a style change) will re-parse and make the state catch up, which can make this look intermittent.
Workaround 🛠️
Force a re-parse after changing the property, for example by nudging a property that does invalidate the text block, or by re-setting Text.
Renderer 🎨
- Skia
Affected platforms 📱💻🖥️
All platforms 🌍 (the Skia text stack is shared)
Uno.Sdk version (and other relevant versions) 📦
Found by code inspection of the current main text stack; the call path above is present in the shipping code.
Anything else we need to know? 💬
This surfaced while auditing every input of the UnicodeText constructor for a performance change (caching the text layout across measure, the way WinUI's BlockNode::CanBypassMeasure does). IsSpellCheckEnabled was the one constructor argument with no invalidation path at all.
That audit also makes this worth fixing before any such caching lands: today the stale state is repaired by the next unrelated re-parse, but with a content-dirty flag it would never be repaired.
Activity