Closed Bug 2057061 Opened 1 day ago Closed 10 hours ago

:empty is not invalidated when ::before uses display: table

Categories

(Core :: CSS Parsing and Computation, defect, P2)

Firefox 155
defect

Tracking

()

RESOLVED FIXED
155 Branch
Tracking Status
firefox-esr115 --- unaffected
firefox-esr140 --- unaffected
firefox-esr153 --- unaffected
firefox153 --- unaffected
firefox154 --- unaffected
firefox155 + fixed

People

(Reporter: jamienk, Assigned: sukil)

References

(Regression)

Details

(Keywords: regression)

Attachments

(1 file)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:155.0) Gecko/20100101 Firefox/155.0

Steps to reproduce:

I have an empty contenteditable. It has CSS for :empty:

.editor:empty::before {
    content: attr(data-placeholder);
}

.editor::before{
    content: " ";
    display: table; << this seems to trigger the issue
}

I type into it

Actual results:

Some of the CSS "content" seems to stay. If I toggle the display: value off/on in devtools it works normally

If "display" is not set to "table" it works as expected

See CodePen: https://codepen.io/Jdevel/pen/KwaxwWg

Video of CodePen fail: https://youtu.be/9irNkjaaCk4

Expected results:

When I type into the contenteditable field, it is no longer :empty so the .editor:empty::before css should stop

This is a recent regression (last few days as of July 22, 2026). Works correctly in FF release, Chrome, Safari, etc

See attached HTML which shows:

  • :empty CSS applies, shows content: attr(data-placeholder);
  • type some text
  • content: attr(data-placeholder); still applies even though not :empty
  • toggle some css off/on (I have JS button that does that) and it correctly shows content: ''

The Bugbug bot thinks this bug should belong to the 'Core::CSS Parsing and Computation' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → CSS Parsing and Computation
Product: Firefox → Core

:sukil, since you are the author of the regressor, bug 1986640, could you take a look? Also, could you set the severity field?

For more information, please visit BugBot documentation.

Flags: needinfo?(sukil)

[Tracking Requested - why for this release]: This feature is riding the trains in 155 and we don't want to ship this regression.

Severity: -- → S3
Status: UNCONFIRMED → NEW
Ever confirmed: true
Priority: -- → P2

The bug is marked as tracked for firefox155 (nightly). However, the bug still isn't assigned and has low severity.

:fgriffith, could you please find an assignee and increase the severity for this tracked bug? Given that it is a regression and we know the cause, we could also simply backout the regressor. If you disagree with the tracking decision, please talk with the release managers.

For more information, please visit BugBot documentation.

Flags: needinfo?(fgriffith)
Assignee: nobody → sukil
Flags: needinfo?(fgriffith)

The table wrapper is the primary frame, but its child InnerTableFrame holds
the non-pseudo-element ComputedStyle, which our update in
HandlePrimaryFrameStyleChange() missed.

Flags: needinfo?(sukil)
Pushed by sukil@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/589a93df90e7 https://hg.mozilla.org/integration/autoland/rev/dc7f12a8cbce Apply text content changes on the frame holding the non-pseudo-element ComputedStyle. r=emilio,firefox-style-system-reviewers,layout-reviewers
Status: NEW → RESOLVED
Closed: 10 hours ago
Resolution: --- → FIXED
Target Milestone: --- → 155 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: