Skip to content

[Skia] Changing TextBox.IsSpellCheckEnabled at runtime does not refresh the spell-check underlines #24210

Open

Description

@MartinZikmund

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:

  1. TextBox.IsSpellCheckEnabledProperty's changed callback calls TextBoxCore.OnIsSpellCheckEnabledChanged — TextBox.cs:491-499. The metadata is plain FrameworkPropertyMetadata with no AffectsMeasure.
  2. OnIsSpellCheckEnabledChangedPartial assigns TextBoxView.DisplayBlock.IsSpellCheckEnabled = newValue and then calls TextBoxView.UpdateProperties() — TextBoxCore.Input.cs:301-308.
  3. TextBlock.IsSpellCheckEnabled is a plain auto-property with no invalidation — TextBlock.cs:1427.
  4. 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.

  1. Create an Uno Platform app with the SpellChecking feature, targeting Desktop (Skia).
  2. Put a TextBox on the page with IsSpellCheckEnabled="True" and type text containing a misspelling, so underlines appear.
  3. 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

  1. added
    triage/untriaged
    on Aug 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    triage/untriaged

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions