Add dismiss button to float teaser bubble#72
Merged
Conversation
Contributor
📦 Snapshot ReleasePublished snapshot packages for this PR: pnpm add @perspective-ai/sdk@1.15.0-pr-72-20260713153600
pnpm add @perspective-ai/sdk-react@1.15.0-pr-72-20260713153600Or use the npm tag (always points to the latest snapshot from this PR): pnpm add @perspective-ai/sdk@pr-72
pnpm add @perspective-ai/sdk-react@pr-72 |
There was a problem hiding this comment.
Pull request overview
This PR adds a user-facing dismiss (“×”) control to the float welcome teaser so users can close the teaser (and notification dot) without opening the chat, with the dismissal persisted for the current browser session to prevent re-arming on navigation or later config updates.
Changes:
- Adds teaser dismiss UX + session-persisted dismissed gating in the float welcome-sequence.
- Introduces
teaser.dismissibleconfiguration across programmatic config, data attributes, and API-merged settings. - Updates styling, tests, and documentation (SDK + React SDK) and ships a minor-version changeset.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/sdk/src/types.ts | Extends TeaserConfig with dismissible option. |
| packages/sdk/src/styles.ts | Adds CSS for the teaser dismiss button. |
| packages/sdk/src/state.ts | Adds sessionStorage helpers for persisted teaser dismissal state. |
| packages/sdk/src/float.ts | Implements dismiss button behavior, persistence, and welcome-sequence gating. |
| packages/sdk/src/float.test.ts | Adds unit tests covering dismiss behavior, persistence, scoping, and opt-out. |
| packages/sdk/src/constants.ts | Adds data attribute + storage key constants for teaser dismissibility/dismissal. |
| packages/sdk/src/browser.ts | Parses data-perspective-teaser-dismissible="false" into config. |
| packages/sdk/src/browser.test.ts | Adds test for the new data attribute parsing. |
| packages/sdk/README.md | Documents dismiss behavior and new config/data attribute. |
| packages/sdk-react/README.md | Documents React usage of teaser.dismissible. |
| .changeset/float-teaser-dismiss.md | Declares minor releases and summarizes the feature. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Customers reported the float teaser could only be closed by opening the chat. This adds an × dismiss button so users can close the teaser (and its notification dot) without engaging the agent. - The × sits at the teaser's top-right corner with aria-label "Dismiss message" and a focus-visible outline matching the other close controls. Its click stops propagation so it never opens the chat. - Dismissing removes the teaser and notification dot and cancels any pending welcome-sequence timers. - The dismissal persists in sessionStorage (keyed by host + researchId), so navigations within the session don't re-show the teaser or replay its chime; a new browser session shows it again. - The welcome-sequence state machine is gated on the dismissed flag so a later update() (e.g. async API config) cannot re-arm a dismissed teaser. Configurable via teaser.dismissible (default true), data-perspective-teaser-dismissible="false", and the API embedSettings.teaser merge. Includes unit tests, browser QA, README updates for both packages, and a minor-version changeset. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01T5HfdvRNFRnuTtdSFt49c7
9429481 to
30483ae
Compare
vinaypuppal
approved these changes
Jul 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Customers reported that the float teaser bubble could only be closed by engaging with the agent (clicking the launcher to open the chat). This adds an × dismiss button so users can close the teaser without opening the chat.
aria-label="Dismiss message", with a:focus-visibleoutline matching the other close controls). Clicking it stops propagation so it never opens the chat.sessionStorage(keyed by host + researchId), so page navigations within the session don't bring the teaser — or its chime — back. A new browser session shows it again.update()(e.g. async API config arriving) cannot re-arm a teaser the user already dismissed.Configuration
Dismissible by default. Opt out via any of the existing config paths:
teaser: { dismissible: false }(programmatic / React prop)data-perspective-teaser-dismissible="false"(declarative)embedSettings.teaser.dismissible(dashboard, takes precedence)Changes
float.ts— dismiss button,dismissTeaser(), and the dismissed-state gate in the welcome sequencestate.ts—get/setPersistedTeaserDismissedsession-storage helpers (mirrors the existing open-state persistence)styles.ts— themed button styles (hover + focus-visible) reusing the existing--perspective-teaser-*/--perspective-close-*variables (light + dark)types.ts,constants.ts,browser.ts—dismissibleonTeaserConfigand the new data attributeTesting
dismissible: falseopt-out, anddata-perspective-teaser-dismissibleparsing.🤖 Generated with Claude Code