Skip to content

fix(element): assert the placeholder paints, not what getComputedStyle says - #256

Merged
PeytonNowlin merged 1 commit into
mainfrom
fix/placeholder-e2e-gecko-attr
Aug 31, 2026
Merged

fix(element): assert the placeholder paints, not what getComputedStyle says#256
PeytonNowlin merged 1 commit into
mainfrom
fix/placeholder-e2e-gecko-attr

Conversation

@PeytonNowlin

Copy link
Copy Markdown
Owner

Closes #254.

What was red

packages/element/test/e2e/placeholder.spec.ts has failed on Firefox in every nightly since it landed in #235 — six consecutive scheduled runs (2026-08-26 through 2026-08-31). Pull requests run verify --quick, chromium only, so nothing on the PR path could have caught it.

Expected substring: "Write the article"
Received string:    "attr(data-placeholder)"

Why

The assertion read the prompt's text back out of the pseudo-element:

getComputedStyle(el, '::before').content

CSS Values 4 substitutes attr() at used-value time. Gecko honours that and returns the specified value, attr(data-placeholder); Blink and WebKit resolve it early and hand back the quoted string. The substring could never appear on Firefox however long the poll ran.

The prompt was never broken

#254 asked for confirmation before touching anything, since the point of the test is that the prompt is visible. It is: Firefox lays out a 128.07px ::before for Write the article… against Chromium's 127.5px and WebKit's 127.5px, in the same muted colour. Only the read-back differed.

What this does

Asserts the box rather than the string, because the box is identical on all three engines:

  • It paints — a generated ::before carrying text has a measured width; one that was never generated reports auto. This is also the stronger claim: content naming a string does not prove the engine laid anything out.
  • The glyphs come from data-placeholder — a longer prompt paints a wider box, same font. That is what the old text assertion was really there for, and it now holds everywhere rather than on two engines out of three.
  • It goes awaycontent: none after one character, unchanged; that value is portable.

The value assertions (the prompt must not serialize into value) are untouched.

Verification

Documentation

No documentation impact. Product code is untouched and the placeholder's documented behaviour is unchanged — docs/api-reference.md:39 already describes it as painted via ::before and never stored in value, which is still exactly right. No CHANGELOG.md entry for the same reason: per AGENTS.md the entry is owed by a behaviour change, and this changes only how a test reads.

…e says

`placeholder.spec.ts` read the prompt back with
`getComputedStyle(el, '::before').content` and looked for the placeholder
text in it. CSS Values 4 substitutes `attr()` at used-value time, so Gecko
returns the specified value, `attr(data-placeholder)`, while painting the
string perfectly well; Blink and WebKit resolve it early and return the
quoted text. The poll could never match on Firefox, and every nightly run
since the spec landed has been red for a difference no reader would see.

The prompt itself is fine on all three engines: Firefox lays out a
128.07px `::before` against Chromium's 127.5px for the same string.

So the spec now asserts the box instead of the string. A generated
`::before` carrying text has a measured width and an ungenerated one
reports `auto`, identically everywhere -- and that is the stronger claim,
since `content` naming a string does not prove the engine laid anything
out. A longer prompt painting a wider box binds those glyphs to
`data-placeholder` on every engine, which is the part the old assertion
was really there for. `content: none` after one character stays as it was;
that value is portable.

Test-only. Verified against chromium, firefox and webkit, and mutation
checked: changing the rule to `content: ''` fails all three.

Closes #254

Signed-off-by: Peyton Nowlin <peytonn98@googlemail.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 31, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-08-31T17:06:52.907426Z c144582 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c144582a0a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

return page.getByRole('textbox', { name: 'Post body' })
}

/**

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Sign off this commit

Commit ccaaadb068a79e349c9391eb0e910f560caafe66 has no Signed-off-by: trailer, so the repository's Sign-off job will reject the PR because it checks every commit with no exemption for test-only changes. Recreate this commit with a trailer matching the commit author.

AGENTS.md reference: AGENTS.md:L7-L11

Useful? React with 👍 / 👎.

@PeytonNowlin
PeytonNowlin merged commit 0cbc38b into main Aug 31, 2026
6 checks passed
@PeytonNowlin
PeytonNowlin deleted the fix/placeholder-e2e-gecko-attr branch August 31, 2026 17:20
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.

e2e: [firefox] placeholder assertion reads attr() unresolved from getComputedStyle, and it is why main is red

1 participant