WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
307455
CSS Custom Highlight API incompatible on Flexbox nodes
https://bugs.webkit.org/show_bug.cgi?id=307455
Summary
CSS Custom Highlight API incompatible on Flexbox nodes
Zach Leatherman
Reported
2026-02-10 11:46:22 PST
Using the Custom Highlight API on a `display: flex` or `display: inline-flex` node doesn’t render the highlighted ranges. e.g. `<div style="display: flex">I want to highlight some text in here</div>` Reproduction:
https://codepen.io/zachleat/pen/MYeZYEN
fails in Safari 26.2 and Safari Technology Preview Release 236 (WebKit 21625.1.1.19.1). Works as expected in Firefox 147 and Chrome 144. Just for completeness, a link to the Custom Highlight API:
https://developer.mozilla.org/en-US/docs/Web/API/CSS_Custom_Highlight_API
Attachments
Testcase
(3.66 KB, text/html)
2026-02-10 12:07 PST
,
Anthony Ricaud
no flags
Details
View All
Add attachment
proposed patch, testcase, etc.
Zach Leatherman
Comment 1
2026-02-10 12:04:01 PST
Current workaround is to add an additional child node: `<div style="display: flex"><div>I can reliably highlight text in here</div></div>`
Anthony Ricaud
Comment 2
2026-02-10 12:07:59 PST
Created
attachment 478306
[details]
Testcase I've adapted Zach's testcase by: - Adding grid and table examples: to check if it was flex specific or a larger issue. It is a larger issue. - Add variants of each with a "real" element: after adding the other cases, I had a hunch it might be related to flex/grid/table creating "anonymous elements" to lay things out. Those variants tend to confirm my hunch (although I'm sure "anonymous elements" ain't the correct term). - Removing inline-flex: With the other examples I added, I felt it was an unnecessary variant to keep. I haven't removed the flex reference from the title of the bug because I wasn't sure what to put instead.
Karl Dubost
Comment 3
2026-02-11 15:34:54 PST
Thanks, Zac and Anthony. Very useful test case.
Radar WebKit Bug Importer
Comment 4
2026-02-11 15:35:13 PST
<
rdar://problem/170181823
>
Karl Dubost
Comment 5
2026-02-11 23:01:57 PST
I have created a WPT test for it.
https://github.com/WebKit/WebKit/pull/58456
That I will export to web-platform-test as soon as it has been reviewed.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug