Skip to content

Fix #106 + clean attribute clear on reflected props#115

Merged
DmitrySharabin merged 2 commits into
rollback-signalsfrom
props-bug-fixes
May 15, 2026
Merged

Fix #106 + clean attribute clear on reflected props#115
DmitrySharabin merged 2 commits into
rollback-signalsfrom
props-bug-fixes

Conversation

@DmitrySharabin
Copy link
Copy Markdown
Member

Summary

Two surgical bug fixes against the rolled-back e344b1f baseline, stacked on top of #114 so each landing has its own regression test already in place.

  • Populate detail on first_connected shortcut re-fires (Populate detail on first_connected shortcut re-fires #106) — direct port of 1984e21 from main. Flips the first_connected shortcut re-fire carries a detail test.
  • Preserve explicit null in reflected attribute writes?? was treating "clear this attribute" the same as "no override given," so writing null/undefined to a reflected prop didn't remove the attribute. Switch to !== undefined. Flips both Clearing a reflected prop removes the attribute / undefined and / null.

Test plan

@DmitrySharabin DmitrySharabin force-pushed the props-behavioral-tests branch from d0b7b51 to d3413a0 Compare May 15, 2026 21:34
@DmitrySharabin DmitrySharabin force-pushed the props-bug-fixes branch 2 times, most recently from a02c7fa to f0956e6 Compare May 15, 2026 21:41
@DmitrySharabin DmitrySharabin force-pushed the props-behavioral-tests branch 2 times, most recently from d0b7b51 to 4c7a82d Compare May 15, 2026 21:45
Base automatically changed from props-behavioral-tests to rollback-signals May 15, 2026 21:51
The re-fire previously dispatched a PropChangeEvent with no detail, so
a listener that read e.detail.value would crash on the catch-up
dispatch while succeeding on the regular dispatch. Populate a minimal
detail with source: "initial" (marker for synthetic catch-up) and
value (the field whose absence caused the crash).

Found while integration-testing nude-element against color-elements
(<space-picker value="oklab" onspacechange="…"> exercises this path).
`change.attributeValue ?? change.element.getAttribute(...)` treated an
explicit null (callers signaling "clear this attribute") the same as
"no override given, look it up on the element." When a reflected prop
was set to null or undefined, the fallback re-read the existing
attribute, so the clear never happened.

Switch to `!== undefined` so `null` propagates to the subsequent
`attributeValue === null` branch and removes the attribute.

Fixes the "Clearing a reflected prop removes the attribute" regression
tests for both `value: undefined` and `value: null`.
@DmitrySharabin DmitrySharabin merged commit 7dccead into rollback-signals May 15, 2026
@DmitrySharabin DmitrySharabin deleted the props-bug-fixes branch May 15, 2026 21:56
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.

2 participants