Skip to content

Populate detail on first_connected shortcut re-fires#106

Merged
DmitrySharabin merged 1 commit intomainfrom
fix-first-connected-detail
May 4, 2026
Merged

Populate detail on first_connected shortcut re-fires#106
DmitrySharabin merged 1 commit intomainfrom
fix-first-connected-detail

Conversation

@DmitrySharabin
Copy link
Copy Markdown
Member

@DmitrySharabin DmitrySharabin commented May 1, 2026

Summary

first_connected re-fires shortcut events for late-bound on*= handlers, but dispatched them with no detail. A listener reading e.detail.value crashed on the catch-up while succeeding on the regular dispatch.

Populate a minimal detail: { source: "initial", value }. source: "initial" is a new enum value marking the synthetic catch-up.

Why

Found integration-testing against color-elements. <space-picker value="oklab" onspacechange="…"> attaches its listener via the onspacechange= attribute after the element has constructed and connected — so the late-bound listener only sees the catch-up dispatch.

Scope

Extracted from #102 (commit 72e605d) so it can land independently — pre-existing bug, unrelated to that PR's batching.

Test plan

  • npm test -- --ci — 97/98 PASS, 1 pre-existing skip, 0 FAIL
  • Manually verified end-to-end against color-elements

No unit test added — the catch-up path needs customElements.define + real DOM, which the JS-first FakeElement infrastructure doesn't provide.

@netlify
Copy link
Copy Markdown

netlify Bot commented May 1, 2026

Deploy Preview for nude-element ready!

Name Link
🔨 Latest commit b377bf8
🔍 Latest deploy log https://app.netlify.com/projects/nude-element/deploys/69f86544c585410008b395a2
😎 Deploy Preview https://deploy-preview-106--nude-element.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

Comment thread src/plugins/events/propchange.js Outdated
Comment thread src/plugins/events/propchange.js Outdated
Comment thread src/plugins/events/propchange.js Outdated
Copy link
Copy Markdown
Contributor

@LeaVerou LeaVerou left a comment

Choose a reason for hiding this comment

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

See comments!

@DmitrySharabin DmitrySharabin force-pushed the fix-first-connected-detail branch from 7589101 to 4125197 Compare May 4, 2026 08:33
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).
@DmitrySharabin DmitrySharabin force-pushed the fix-first-connected-detail branch from 4125197 to b377bf8 Compare May 4, 2026 09:22
@DmitrySharabin DmitrySharabin merged commit 1984e21 into main May 4, 2026
4 checks passed
@DmitrySharabin DmitrySharabin deleted the fix-first-connected-detail branch May 4, 2026 14: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.

2 participants