v143 · javascript

EditContext: TextFormat underlineStyle and underlineThickness

Chromium shipped https://developer.mozilla.org/en-US/docs/Web/API/EditContext with a bug where the https://developer.mozilla.org/en-US/docs/Web/API/TextFormat object supplied by the https://developer.mozilla.org/en-US/docs/Web/API/EditContext/textformatupdate_event provides incorrect values for the underlineStyle and underlineThickness properties. In Chromiu

concepts

  1. EditContext Underline

    Live editor attached to an EditContext. Compose text (or click Simulate) and watch the textformatupdate event report the corrected underlineStyle and underlineThickness.

  2. IME style painter

    What the corrected values are actually for: IME composition presets (Japanese / Chinese / Korean / grammar / spell-check) rendered with the appropriate underline style and thickness.

  3. Underline gallery

    The full 6×3 matrix of underlineStyle × underlineThickness values from the spec, rendered side by side with a picker for live comparison and a notes panel mapping each pair to its conventional editor use.

  4. Custom Input Method

    An EditContext-wired editable div with a simulated IME panel: type to compose, choose from five preset suggestions, and commit. Underlines are rendered via inline CSS matching TextFormat API values. A style picker lets you choose underlineStyle and underlineThickness with live preview, and a format log timestamps every format event with range and style values.

why it shipped

The TextFormatUpdateEvent is fired when the formatting attributes of text content change within an EditContext. It provides a structured interface to access formatting information such as underline style, underline thickness, and other visual characteristics through the getTextFormats() method.

references