Skip to content

[DX-1371] Update search and Ask AI behaviour#3396

Open
m-hulbert wants to merge 1 commit into
mainfrom
dx-1371-search
Open

[DX-1371] Update search and Ask AI behaviour#3396
m-hulbert wants to merge 1 commit into
mainfrom
dx-1371-search

Conversation

@m-hulbert

Copy link
Copy Markdown
Contributor

Description

This PR updates the Search bar and Ask AI button to match styles between local and production. It also changes the rendering so that they're always visible in a local setup, however the triggers are disabled.

Checklist

@m-hulbert m-hulbert self-assigned this Jun 4, 2026
@coderabbitai

coderabbitai Bot commented Jun 4, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: f2a96901-f9d9-4837-a853-8744304b50d0

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dx-1371-search

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@m-hulbert m-hulbert requested a review from jamiehenson June 4, 2026 17:15
@m-hulbert m-hulbert marked this pull request as ready for review June 4, 2026 17:15
@jamiehenson jamiehenson added the review-app Create a Heroku review app label Jun 4, 2026
@ably-ci ably-ci temporarily deployed to ably-docs-dx-1371-searc-r8aixs June 4, 2026 17:20 Inactive

@jamiehenson jamiehenson left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Mostly a heads-up plus a couple of nits — not blocking.

The bit I want to be sure of: the visible Search button now opens the modal by clicking into #inkeep-search's shadow DOM while that instance sits in a display:none holder — and that reach-in has only ever been done against the chat widget before. If Inkeep's search trigger isn't a bare <button> (or is nested differently) it silently no-ops and the button does nothing, with no error, and the jsdom tests only check it renders.

So — are we confident this works in both environments? i.e. unconfigured Inkeep (local / flags off, button inert by design) and configured Inkeep (prod / flags on, button actually opens the modal). I've kicked off a review app to poke at it.

Two nits inline. Also tiny: title typo, "behavor" → "behaviour".

~ 𝒞𝓁𝒶𝓊𝒹𝑒

Comment thread src/components/Layout/Header.tsx Outdated
Comment on lines +273 to +281
onClick={() => {
const chatContainer = document.querySelector('#inkeep-ai-chat > div');
const chatButton = chatContainer?.shadowRoot?.querySelector('button');

track('docs_ask_ai_button_clicked');
track('docs_ask_ai_button_clicked');

if (chatButton) {
chatButton.click();
}
}}
>
<Icon name="icon-gui-sparkles-outline" size="20px" />
<span>Ask AI</span>
</button>
)}
if (chatButton) {
chatButton.click();
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This Ask AI onClick is now a near-twin of openInkeepSearch up top — query #X > div → shadow button → track → click. Worth pulling both into one openInkeepWidget(hostSelector, trackEvent) so the shadow-DOM reach-in lives in a single place.

~ 𝒞𝓁𝒶𝓊𝒹𝑒

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I've addressed this in 91bad22

Comment on lines +182 to +183
expect(screen.getByText('Search')).toBeInTheDocument();
expect(screen.getByText('Ask AI')).toBeInTheDocument();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

These only assert the buttons render, not that clicking them opens anything — so if the shadow-DOM open path breaks, the tests stay green. A click-wiring test (mock querySelector, assert the trigger fires) would catch that. The real shadow DOM isn't jsdom-friendly so it's partial at best, but the click path is the risky bit worth pinning down.

~ 𝒞𝓁𝒶𝓊𝒹𝑒

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This one too: 91bad22

@m-hulbert m-hulbert temporarily deployed to ably-docs-dx-1371-searc-anpwjp June 22, 2026 08:27 Inactive
@m-hulbert m-hulbert changed the title [DX-1371] Update search and Ask AI behavor [DX-1371] Update search and Ask AI behaviour Jun 22, 2026
@m-hulbert m-hulbert temporarily deployed to ably-docs-dx-1371-searc-anpwjp June 22, 2026 08:40 Inactive
@m-hulbert m-hulbert temporarily deployed to ably-docs-dx-1371-searc-anpwjp June 24, 2026 08:33 Inactive
@m-hulbert m-hulbert temporarily deployed to ably-docs-dx-1371-searc-anpwjp June 24, 2026 13:03 Inactive
@m-hulbert m-hulbert requested a review from jamiehenson June 24, 2026 14:36

@jamiehenson jamiehenson left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good in the review app — header search bar + Ask AI render identically local vs prod, and the inert local triggers behave. Good to merge after a couple of small things.

Mandatory

  • openInkeepWidget calls track(eventName) before checking the trigger resolves, so inert clicks (local / no widget) still fire docs_search_button_clicked / docs_ask_ai_button_clicked analytics with nothing actually opening. Reorder so we only track a real open:
    const openInkeepWidget = (hostSelector: string, eventName: string) => {
      const trigger = document.querySelector(`${hostSelector} > div`)?.shadowRoot?.querySelector('button');
      if (!trigger) return;
      track(eventName);
      trigger.click();
    };

Nits

  • SearchTrigger is a plain arrow; rest of the file types components as React.FC. Tiny consistency thing.
  • The new block comments run a bit longer than the file's one-liner style — happy to leave them though, they earn it explaining the shadow-DOM reach-in.
  • Worth squashing the fixup! commit before merge.

~ 𝒞𝓁𝒶𝓊𝒹𝑒

@m-hulbert m-hulbert temporarily deployed to ably-docs-dx-1371-searc-anpwjp June 25, 2026 09:58 Inactive
Replace the production Inkeep-rendered search bar with our own design-matched
trigger so the header search bar is identical in local and production.

- Add a SearchTrigger button (200x36, grey fill, border, 'Search' placeholder,
  Cmd/K keycaps) rendered in both environments. It opens the existing Inkeep
  search modal on click (via the hidden #inkeep-search instance) and is inert
  locally; the modal itself is unchanged.
- Park the Inkeep search instance in a hidden holder (#inkeep-search-holder)
  instead of surfacing its own bar on desktop; mobile behaviour is unchanged.
- Always render the Ask AI button (drop the inkeepChatEnabled gate) so it shows
  locally too; it no-ops when the chat widget isn't loaded.
- Update Header tests for the always-rendered trigger and Ask AI button.

DX-1371

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@jamiehenson jamiehenson left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Re-reviewed — all points addressed: track() now fires only on a real open, SearchTrigger typed as React.FC, and the branch is squashed + rebased on latest main (clean reconcile with the DX-1128 Icon migration). CI green. Approving.

~ 𝒞𝓁𝒶𝓊𝒹𝑒

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review-app Create a Heroku review app

Development

Successfully merging this pull request may close these issues.

3 participants