Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions pages/src/styles/docsearch.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import assert from "node:assert/strict";
import { readFile } from "node:fs/promises";
import { createRequire } from "node:module";
import { test } from "node:test";

const require = createRequire(import.meta.url);

test("shows the Ask AI remove-conversation button that the dialog stylesheet hides", async () => {
// AskAiButton loads the dialog stylesheet next to sidepanel.css, and the dialog one hides the button...
const dialog = await readFile(require.resolve("@docsearch/css/dist/style.css"), "utf8");
assert.match(dialog, /\.DocSearch-Hit-action-button\{[^}]*display:none/);
// ...so the site has to show it again in the conversation history.
const site = await readFile(new URL("./global.css", import.meta.url), "utf8");
assert.match(
site,
/\.DocSearch-Sidepanel-RecentConversation \.DocSearch-Hit-action-button \{\s*display: block;\s*\}/
);
});
6 changes: 6 additions & 0 deletions pages/src/styles/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@ html {
.DocSearch-SidepanelButton {
display: none !important;
}
/* The conversation history reuses the dialog's remove button (.DocSearch-Hit-action-button). The panel loads
the dialog stylesheet too, which hides that button outside a selected search hit, and sidepanel.css never
shows it again, so a conversation could not be removed. Same fix as @docubook/plugin-search-algolia. */
.DocSearch-Sidepanel-RecentConversation .DocSearch-Hit-action-button {
display: block;
}
:root:root {
--docsearch-font-family: inherit;
--docsearch-primary-color: var(--color-accent);
Expand Down
Loading