Frontend engineer reviewing CSS @starting-style rules and browser event logs to diagnose a missing entry transition.

CSS @starting-style Was Declared. Why Did the Entry Transition Not Run?

Wed, Nov 18, 2026

When an element is added to the DOM or toggled from display: none, a CSS entry transition should run from its declared @starting-style to its target style. However, teams often see a “green” outcome (element appears correctly) without the entry animation playing. This indicates that superficial success has masked a missing transition. The root cause usually lies in mismatches between the declared starting style, CSS cascade order, and the browser’s default transition behavior.

In this playbook, we define a precise acceptance contract for entry transitions, build a controlled test fixture, and capture exact event evidence. We compare the documented model (specification and MDN guidance) with observed behavior. Key questions include: Was the @starting-style applied at the right specificity? Did the browser fire transitionrun, transitionstart, and transitionend events as expected? Did any properties like display or overlay require transition-behavior: allow-discrete to enable animation? By pinning environment versions and isolating the test, we avoid guessing and focus on observable signals. The final decision (ACCEPT, REPAIR, RERUN, or HOLD) depends on strictly reconciling declared contracts with logged evidence. This article guides senior engineers through each step of that process, with code examples, tables of expected vs actual events, and a decision matrix.

1. Define the acceptance contract

The acceptance contract answers one narrow question: Should an entry transition run, and if not, why not? We require explicit evidence that an element with an @starting-style transition on its first render fires the expected CSS transition events and reaches the final state. By the CSS Transitions Level 2 spec, an @starting-style rule provides a “before-change” style for elements that lack a previous style. That means when the element is first inserted (or becomes visible), the transition compares the @starting-style values to the new computed values to start the animation. MDN confirms that without @starting-style, “transitions are by default not triggered on an element’s initial style update, or when its display changes”. Thus, our contract is:

  • Starting style match: The element’s computed style before the transition (from @starting-style) must match the declared values.

  • Transition properties: The CSS transition-property, duration, and timing-function include the targeted property (e.g. opacity) and any necessary properties (display, overlay) to allow entry transitions on hiding/showing.

  • Lifecycle events: We expect a transitionrun event (transition creation) and transitionstart/end events for the property. According to MDN, transitionrun fires when a transition is first created, transitionstart fires when it actually begins (after any delay), and transitionend fires on completion.

  • Final state: The computed style at the end of the animation must equal the intended target state (e.g. final opacity).

  • Failure signals: If any event is missing or a wrong property transitions, that violates the contract. For example, MDN notes if transitioncancel fires, transitionend will not fire, signaling an aborted transition.

  • Negative control: If no @starting-style or transition (e.g. zero duration), then no events should fire, and the element should simply take its final state immediately.

Together, these assertions tie directly to our scope: entry transitions on newly rendered or display-changed elements, using @starting-style. We will later compare observed events against this contract and decide whether the transition behavior is correct or needs a fix. Our success signal is not just “the element appeared correctly” but “the transition events and timing match the declared contract.” See a similar contract approach in CSS transition cancellation and completion events for interrupted transitions.

2. Capture the baseline and pin versions

Before testing, we capture the documented baseline behavior. The normative reference is CSS Transitions Module Level 2, § 3.3, which defines @starting-style: it applies to elements “not rendered or part of the DOM” in the previous update. The spec explains that if an element has no “before-change” style (e.g. it’s newly inserted or was hidden), the @starting-style values are used to start transitions. MDN’s description aligns: it explicitly warns entry transitions won’t run without @starting-style. In practice, this means our element should use @starting-style when first added or when toggling display: none, as MDN says (e.g. opacity from 0 to 1 on insert).

We also note the role of transition-behavior: allow-discrete, which CSS Transitions Level 2 introduces to handle discrete properties (display, content-visibility). MDN’s example shows that to animate from display: none or top-layer promotion, one must include display and overlay in the transition list and use allow-discrete. Lacking this, the entry animation could still silently fail.

For reproducibility, we pin exact runtime versions. For example, we might use Node.js 26.13.0 LTS (Oct 2026) and Playwright 1.66.0 with Chromium 158 (as of late 2026) to match a stable test environment. We include these in our test manifest (package.json) explicitly. Any deviation in Node or browser version is a RERUN scenario, not an ACCEPT difference. In summary, our documented baseline is: with the correct @starting-style and transition settings, an entry animation should fire; anything else signals a defect. Disagreements between spec and MDN (if any) are flagged. If, for instance, an older browser lacks support, that is noted as a versioned behavior but still fails our contract.

Pin exact environment versions

To ensure reproducibility, we choose concrete versions. For example: Node 26.13.0 (LTS, Oct 28 2026) and Playwright 1.66.0 (bundling Chromium 158). In our fixture, package.json uses exact deps:

{
  "name": "css-starting-style-fixture",
  "private": true,
  "version": "1.0.0",
  "engines": { "node": "26.13.0" },
  "scripts": { "test": "playwright test --reporter=line" },
  "devDependencies": { "@playwright/test": "1.66.0" }
}

Running npm ci && npx playwright install ensures the test harness is fixed. If any version (Node, Playwright, or browser) differs, the test result is marked RERUN, as differing engines could produce different behavior.

3. Build the disposable controlled fixture

We create a minimal HTML/CSS/JS fixture focusing on one element and one transition. No frameworks, no network. Example fixture:

<!-- index.html -->
<!DOCTYPE html>
<html>
<head>
<style>
  /* Original rule: final state is opaque and scaled /
  #box {
    opacity: 1;
    transform: scale(1);
    transition-property: opacity, transform, display;
    transition-duration: 0.5s;
    transition-timing-function: ease;
    / Include display and overlay with allow-discrete
       in a shorthand /
    transition: opacity 0.5s ease,
                transform 0.5s ease,
                display 0.5s allow-discrete;
  }
  / Starting style rule: initially invisible and scaled down /
  @starting-style {
    #box {
      opacity: 0;
      transform: scale(0);
    }
  }
  / For negative control: a version without @starting-style */
  #box.no-start {
    opacity: 0;
    transform: scale(0);
  }
</style>
</head>
<body>
  <button id="show-btn">Show Box</button>
  <!-- Box is initially not in DOM -->
</body>
</html>

The fixture’s JavaScript, executed after the markup has loaded:

const btn = document.getElementById('show-btn');
btn.addEventListener('click', () => {
  const box = document.createElement('div');
  box.id = 'box';
  box.textContent = 'Animate me';
  document.body.appendChild(box);
});

This fixture adds <div id="box"> on button click, so it is first inserted with no prior style. We expect it to animate from opacity:0, scale(0) to opacity:1, scale(1) because of the @starting-style rule. The CSS includes transition-property: display and uses allow-discrete shorthand to ensure display changes animate (per the spec). The .no-start CSS class is for a negative control case (no @starting-style), to verify that without starting style no entry animation runs.

This controlled fixture isolates the case: one element, one transition, no external influence. It’s tested locally (e.g. with Playwright) by loading this file in a blank browser context. The code is “disposable” because it uses a temp directory and no external resources after installation.

4. Author the independent expected-case manifest

Before running tests, we write down what should happen in each scenario. Each case’s expected output is recorded in a manifest (like a table or JSON) before observing real output. For example:

  • Case A (Primary): Add the box with @starting-style. Expect: one transitionrun, one transitionstart, one transitionend for opacity (and transform) property. Final state: opacity=1, transform=scale(1).

  • Case B (No starting style): Add the box with a CSS class .no-start instead of @starting-style. Expect: no transition events (because no before-state was defined). The box should appear instantly at opacity=1.

  • Case C (Zero duration): Same as Case A but CSS transition-duration: 0s. Expect: no transition events (events only fire for nonzero duration) and immediate final state.

  • Case D (Different property): e.g. @starting-style for background-color only. Expect: only background transition events, no opacity events.

  • Case E (Reinsert after removal): Remove box and re-add. Expect: the starting style still applies on each insertion, so events again.

For each case, we identify falsifiable outcomes. If Case A yields no events, it violates the contract. If Case B yields any event, it fails the negative control. We note these in a manifest table:

Case

CSS Setup

Expect Events

Expect Final State

A

@starting-style on #box

run, start, end (opacity)

opacity=1, scale=1

B

.no-start rule (no @starting-style)

none (no events)

opacity=1, scale=1 (instant)

C

Case A but transition-duration: 0s

none (no events)

opacity=1, scale=1

D

@starting-style for background-color only

run, start, end (background-color only)

background-color=#target

E

Add, remove, re-add #box with @starting-style

same as Case A on each insert

opacity=1, scale=1 each time

Each line is an independent check. We mark all results EXPECTED initially (none executed yet). This manifest acts as our independent “oracle” for correct behavior, separate from any browser output. It avoids the pitfall of accepting a green test just because the final style is correct. We explicitly associate events with cases to avoid mislabeling. (The process is similar to the task-coverage ledger in Ansible check-mode task coverage in that we map expected checks to observed signals, but we do it here for CSS events.)

Specify a falsifiable negative control

For example, Case B above is a negative control. The assertion is “no transition events fired when no starting style is present.” We can write it as: If any transitionrun/start/end event occurs in Case B, reject. In code:

if (caseB.events.length > 0)
  throw new Error("Unexpected transition in negative control");

This is bounded: final state check alone isn’t enough. We require zero events. We can assert it in our test harness (marked EXPECTED until run).

5. Reproduce the misleading green result

First, we run the naive scenario that often “passes” without alerting us. For instance, just adding the element with final CSS (no explicit check of events). We confirm the final style is correct, and the test might report PASS if it only checked visibility or final opacity. But our evidence ledger will show that transitionstart/end never fired. For example, a superficial test might log:

PASS: #box final opacity is 1 (target).

But this is misleading: it ignores that the transition animation never ran. We replicate this by writing a Playwright script that adds the element and then immediately checks getComputedStyle(#box).opacity === '1'. It will pass. We log that result as misleading because the acceptance contract was about events, not just final state.

We must record the raw event captures. For example, a simple console log in the page might show:

el.addEventListener("transitionend", () => console.log("ended"));
el.addEventListener("transitionstart", () => console.log("started"));

If nothing prints, we have a problem. We reproduce this “green” test result and show in our report:

Case A: final opacity = 1 (OK). But no transition events captured.

This reproduces the false-positive scenario. We mark the pass as misleading: success by final value but violation of contract (missing events).

6. Run a valid comparison case

Next, we instrument the test to capture events and delays. For instance, using Playwright or plain JS, we attach listeners:

const events = [];
el.addEventListener("transitionrun", e => events.push("run:"+e.propertyName));
el.addEventListener("transitionstart", e => events.push("start:"+e.propertyName));
el.addEventListener("transitionend", e => events.push("end:"+e.propertyName));

Then we add the element and wait. We can simulate the click:

npm test  # Runs Playwright test script
cat artifacts/events.json

where events.json is output by the test harness. In a correct run, for Case A we expect something like ["run:opacity", "start:opacity", "end:opacity"]. We preserve this raw log as our evidence. In a table, we compare:

Case

Expected Events

Observed Events

A

run, start, end (opacity)

e.g. run:opacity, start:opacity, end:opacity

B

(none)

e.g. (no events)

C

(none)

e.g. (no events)

For each case, we validate the exact event names and counts. If they match the manifest, good; if not, we annotate. For example, if Case A’s log is empty, we note “FAILED: No events fired”. If extra events appear, we flag them (e.g. if transform also fired). We label each result as EXPECT/NOT RUN initially. Actual runs would fill in Observed and change to PASS/FAIL accordingly, but for planning we write them as Expected until execution.

Preserve failure artifacts

If any run fails the contract, we save all artifacts: event logs, screenshots, etc. For example, if Case A fails (no transition), we keep events.json and perhaps a video. These raw artifacts go into a ledger and a failure report. A table might look like:

Case

Property

transitionrun

transitionstart

transitionend

Final computed

Decision

A

opacity

YES

YES

NO

1 (expected 1)

REPAIR

B

opacity

NO

NO

NO

1 (expected 1)

ACCEPT

Bold indicates missing expected event. For Case A above, missing transitionend triggers a FAIL/REPAIR.

7. Exercise negative and boundary cases

We test the edge conditions to ensure robustness. For example:

  • Zero-duration boundary: Setting transition-duration: 0s should fire no events. We verify our harness logs none.

  • Zero-delay boundary: If delay is 0, we should see run and start back-to-back.

  • Different property boundary: If @starting-style sets background-color but transition-property only includes opacity, we expect no opacity transition.

  • Repeated adds: Adding, removing, and re-adding the element should allow the transition again each time (since after removal the element is no longer rendered).

  • Unsupported browser: If a browser simply doesn’t support @starting-style (unlikely in our pinned Chrome), we’d see no events. This is a form of versioned behavior, resulting in HOLD if untested. Each boundary case either confirms the contract or isolates its limits.

8. Capture the per-case evidence ledger

We maintain a ledger row for each case, linking expected vs actual. For example:

Case

Condition

Expected Events

Observed Events

Final Value

Conforms?

A

First render, with @ss

run, start, end

(log entries)

OK (1.0)

(TBD)

B

First render, no @ss

none

(should be none)

OK (1.0)

(TBD)

C

0s duration

none

OK (1.0)

(TBD)

...

...

...

...

...

...

We fill this after execution. Each row starts as NOT EXECUTED for actuals. When run, we mark PASS or FAIL per assertion (events and final state). If a row lacks evidence (e.g. we forgot to capture in code), we mark it incomplete.

Reject incomplete evidence

If any row has missing data, we hold: e.g. “no transitionrun listener attached, evidence incomplete.” We treat that as a test failure (HOLD state) because we can’t reconcile. For example, if the code forgot events.push on transitionstart, we would reject that run. All columns in a row must be filled from actual output (events array, computed style) before acceptance. Any empty cell triggers HOLD.

9. Reconcile expected and observed identities

Now we compare each case’s observed events and values to the expected manifest. If they match exactly, evidence is consistent. If not, we analyze mismatches. For instance, if Case A observed run:opacity and end:opacity but no start:opacity, that hints at a timing or event issue. We might have accidentally missed the transitionstart listener, or the transition started immediately (zero delay), but it should still fire by spec. Another example: if Case D (background-color) unexpectedly had opacity events, that suggests our fixture had a different target property. We then reconcile by checking:

  • Were the event.propertyName values as expected?

  • Did any extra transitions occur (maybe we forgot opacity in transition-property)?

  • Did final computed style match the triggered events?

  • Are we mixing up the identity of tests (e.g. accidentally using the box from Case A in Case E)? If something doesn’t match, we note it and include it in the ledger commentary. If needed, consult the CSS spec: e.g. spec §3.3 clarifies that @starting-style does not apply to “after-change” style, so if we mis-cascade rules, it won’t stick. This reconciliation is crucial: we do not alter the manifest post-hoc. The observed events must be interpreted as pass/fail signals.

10. Separate documented guarantees from observations

We distinguish what should happen from what we saw. The spec promises transitions on first render when properly declared, but if our test didn’t see it, we must investigate the cause before blaming the browser. For example, MDN notes the @starting-style rule must come after the original rule to apply. If our CSS had the wrong order, the starting values would be overwritten, explaining the missing animation. We check the cascade: was our @starting-style rule truly effective (highest precedence or placed last) as MDN requires? If not, the remedy is a CSS fix, not a browser bug. This step sets the scope for repair: don’t rewrite global animation logic if simply our CSS ordering was wrong.

In terms of repair scope, we bound it to CSS and harness fix. For instance, if we find that transition-behavior: allow-discrete was missing and that’s why discrete properties didn’t animate, we patch CSS to add it. We do not escalate to unrelated parts (no need to rewrite DOM code).

Bound the repair scope

For example, if we discover the failure was due to missing transition-behavior, the repair is only to the CSS snippet. We provide a proof-of-concept patch:

#box {
  transition: opacity 0.5s ease, transform 0.5s ease, display 0.5s allow-discrete;
}

Here we’ve bounded the fix to the CSS rule. We might note in the ledger: “Added allow-discrete to include display transitions”. If the root cause had been a script ordering issue, we’d correct only the harness. The goal is the smallest change that brings observed behavior into alignment.

11. Implement a bounded repair

Based on the mismatch, we implement and test a targeted fix. Continuing our example: suppose the real issue was lack of display in transitions. We update the fixture CSS to include display in transition-property and add allow-discrete. We rerun just Case A:

# Modify test fixture: include 'display 0.5s allow-discrete' in transition
npm test
cat artifacts/events.json

We expect to see the missing event now fire. We update the ledger: if transitionend now appears, Case A passes. We still mark the case REPAIR in the decision log if it previously failed. If the repair didn’t fix it, we would escalate (maybe the issue was something else). Each repair attempt must be local: e.g. adding a one-liner, not rewriting the entire style system.

12. Test rollback and rerun safety

To ensure no new failures, we rollback the test harness and repeat. First, we restore the fixture to the previous state and confirm the failure reproduces (HOLD state remains). Then we reapply the repair and confirm the pass. This sequence ensures our fix is neither masking nor incidental. We also try clean states: run with a fresh browser profile, in case cached style state could mask issues. We document in our report:

  • “Rollback: Confirmed original failure (no transitionend).”

  • “Reapply fix: Now all events captured as expected.”

We consider re-run safety. For example, if our fix required a browser flag or polyfill, that would be a larger scope (likely a HOLD or RERUN decision). We ensure our fix works consistently in the pinned environment.

Assign operational ownership

For future reference, we note who will maintain this test fixture and responses. For instance: “This CSS transition test belongs to the frontend UI team owning the popover component. They should re-run this validation on each relevant release (e.g. browser engine upgrade).” This ties to Refonte Learning’s guidance on validated release gates where clear responsibility is essential. Here, the playground code’s author or QA lead would own the script and analysis.

13. Decide ACCEPT, REPAIR, RERUN or HOLD

Finally, we make a gate decision. We construct a matrix:

Outcome

Condition

Decision

ACCEPT

All cases passed contract on pinned versions (events & states match expected)

Release OK

REPAIR

One or more cases failed due to fixable CSS/harness issue (e.g. missing property in code)

Code needs patch

RERUN

Observed difference only under a different browser/version than pinned (version drift)

Test on new build

HOLD

Evidence incomplete or contradictory (e.g. missing logs), or unspecified environment

Investigate further

For example, if after repairs all events align with spec, we ACCEPT the test. If Case A still lacks an event, we mark REPAIR until fixed. If our pinned Chrome passes but Firefox fails, we mark RERUN to investigate cross-browser. If logs were wiped or an event listener broke, we mark HOLD because we can’t conclude. Each decision entry is justified by our ledger:

  • REPAIR: “Transitionend still absent; fix CSS or harness.”

  • ACCEPT: “Ledger shows run, start, end as expected for all cases.”

  • RERUN: “Firefox deviated; re-evaluate on latest Firefox build.”

  • HOLD: “No events captured for all cases (test bug).”

We do not let a green final style alone decide acceptance. The final output (see table below) is one of ACCEPT, REPAIR, RERUN, or HOLD for the whole gate.

Case

Outcome

Action

Entry transition (all cases)

PASS

ACCEPT

Missing transitionend in Case A

FAIL

REPAIR

Unknown at new browser version

N/A

RERUN

Incomplete log capture

N/A

HOLD

14. Connect the practice to Refonte Learning

This evidence-driven testing approach aligns with the Frontend Development curriculum at Refonte Learning, which emphasizes practical validation and independent verification. In a Refonte context, you would build such fixtures and ledgers to ensure feature correctness before release. For readers interested in honing these skills, see Refonte Learning’s Frontend Development Program for hands-on projects and internship opportunities in web development.