w3c / w3c/csswg-drafts

[css-pseudo-4] Should highlights paint for Control Characters, esp. tab

Open
#9,849 3 comments 0 reactions 1 assignee View on GitHub

@schenney-chromium is already working on this.

Since Jun 25, 2026.

css-pseudo-4 Needs Edits Needs Testcase (WPT)
Dominant language
Bikeshed
Stars
4.9k
Forks
816
Avg merge
2d 18h
Merged PRs (30d)
24

Description

I believe the spec should be explicit about which, if any, ASCII control characters should be potential targets of highlight pseudos. For reference, the CSS Text Decorations spec says "Characters belonging to the Unicode classes for control codes and unassigned characters (Cc, Cf, Cn) are skipped...". That includes tabs.

However, chromium does paint tabs for selection, and has a bug (or feature) that it will draw underlines and highlights for tab characters when used in ::selection.

I see 2 possible resolutions:

  • Adopt the Text Decoration behavior for highlights and make ::selection that uses such features follow the same rules.
  • Special case the tab character as a control character that text decorations and highlights do apply to.

I don't think the behavior for text decorations and highlight should be different, given that text decorations can be used as highlights.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.