Skip to content

Spellcheck: Live check - #776

Open
robinbisping wants to merge 5 commits into
masterfrom
spellcheck-live-check
Open

Spellcheck: Live check#776
robinbisping wants to merge 5 commits into
masterfrom
spellcheck-live-check

Conversation

@robinbisping

@robinbisping robinbisping commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Relations:

Description

Spellchecking needs to underline mistakes in a text, but a mistake is not part of the document. The existing highlighting wraps text in marker elements, which would put the underlines into the content. This adds a second way to highlight, built on the CSS Custom Highlight API. The browser paints the ranges and the DOM stays untouched.

  • setCssHighlight({name, ranges}) highlights character ranges under a name. One call can cover ranges in many editables, and it replaces everything held under that name. The look is up to the consumer through the ::highlight() selector.
  • deleteCssHighlight({name}) removes the highlights of a name and forgets where they were.
  • getCssHighlightText({editableHost}) returns the text of an editable without its markup. This is the text the character offsets count against.
  • getCssHighlightCursorOffset({editableHost}) returns the cursor position as a character offset in that text, which tells a caller which highlight the cursor sits in.
  • getCssHighlightRects({editableHost, start, end}) returns where a character range sits on screen, so a caller can place a popover next to it.
  • replaceCssHighlight({editableHost, start, end, text}) replaces a character range with new text, dispatched like any other edit.

Changelog

  • 🎁 New API to highlight character ranges in an editable without changing its content, based on the CSS Custom Highlight API. Highlights survive markup changes such as comments and formatting.

@robinbisping robinbisping changed the title Spellcheck Spellcheck: Live check Aug 21, 2026
@robinbisping
robinbisping force-pushed the spellcheck-live-check branch from fc34d11 to 7bbb8c6 Compare August 21, 2026 12:01
@robinbisping
robinbisping marked this pull request as ready for review August 21, 2026 12:15
@robinbisping
robinbisping requested a review from eileenoo August 21, 2026 12:15
@eileenoo
eileenoo requested review from ajwild and arddor August 26, 2026 11:36
@ajwild

ajwild commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

My main question would be whether something introduced in Firefox in March 2026 is ready for roll-out, I've been thinking about this for comments, but I wasn't sure we could move forward with it until March 2027. I'll try to dig into how things work on older versions of Firefox.

@robinbisping

robinbisping commented Aug 28, 2026

Copy link
Copy Markdown
Contributor Author

My main question would be whether something introduced in Firefox in March 2026 is ready for roll-out, I've been thinking about this for comments, but I wasn't sure we could move forward with it until March 2027. I'll try to dig into how things work on older versions of Firefox.

Ah, I have a misunderstood it then. I thought we discussed this briefly in a team meeting and the conclusion was that we should move forward with CSS highlights even though Firefox just introduced support for it.

Realisticly this feature will only be rolled out beginning of next year anyway. No customer has signed a contract yet. So that makes the Firefox issue a bit less severe. But of course we'd still break our own promise.

What we need for sure is error handling if the feature is not supported. That's still lacking.

Let's discuss in the meeting how to proceed here. :)

@ajwild

ajwild commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Sorry, you're right, I'd forgotten about that discussion. It's also a great point about the expected roll-out date - we'll be around 1 year of browser support by then anyway. We should just bump the supported browser versions listed on the technical release notes whenever a customer starts to use it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants