Skip to content

Fix widget config in <head> and stale mention selection - #207

Merged
mpge merged 3 commits into
mainfrom
fix/widget-head-and-mentions
Oct 20, 2026
Merged

mpge merged 3 commits into
mainfrom
fix/widget-head-and-mentions

Conversation

@mpge

@mpge mpge commented Oct 20, 2026

Copy link
Copy Markdown
Member

Summary

  • Widget (high): when embed.js sits in <head>, boot waits for DOMContentLoaded, by which point document.currentScript is null, so every data-* setting and the src-derived backend URL were lost (requests went to the host page's own origin). The script tag is now captured while the bundle is evaluated and passed to boot(). There is also a fallback to script[src*="/widget/embed.js"] next to script[data-escalated-widget].
  • Mentions (medium): suggestions now record the query they were fetched for. While the list on screen belongs to an older query (debounce or request pending), Enter/Tab are swallowed. No stale agent gets inserted, the chat message is not sent, and the dropdown stays visible. Applies to ChatComposer and ReplyComposer.
  • Low: TicketList and QuickFilters accents and the focused row now fall back to the light panel preset when the host sets no theme.panel. Guest/Create shows the ticket lookup only when both lookup_url and verification_url are present, instead of posting to null.

Tests

  • tests/widget/loader.test.js: loads the bundle from <head> (no body and currentScript set during evaluation, then DOMContentLoaded) and checks that config and the backend URL are used. A second test covers the src fallback.
  • Mentions: tests for the composable pending state, the dropdown swallowing Enter/Tab, and a ChatComposer end-to-end test (Enter during the debounce neither sends nor inserts, and the fresh result is picked once it lands). The existing "keeps the current suggestions visible" test still passes.
  • GuestCreate: the lookup form is hidden without verification_url.
  • The new tests fail without the source changes. Full suite: 814 passed. npm run lint and prettier are clean.

mpge added 3 commits October 20, 2026 00:25
Capture document.currentScript while the bundle is evaluated and pass it
to boot(), since it is null by DOMContentLoaded. Fall back to a script
whose src points at /widget/embed.js as well as data-escalated-widget.
Suggestions now record the query they were fetched for. While the list on
screen belongs to an older query, Enter/Tab are swallowed: no stale agent
is inserted and the chat message is not sent. The list stays visible.
…fication

TicketList and QuickFilters fall back to the light panel preset colours
when the host sets no theme.panel. Guest/Create only shows the ticket
lookup when both lookup_url and verification_url are present.
@mpge
mpge merged commit 4360cd8 into main Oct 20, 2026
11 checks passed
@mpge mpge mentioned this pull request Oct 20, 2026
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.

1 participant