From b6f46a07944dc61a4d6c8c9cc2cf02f6c2f6e27a Mon Sep 17 00:00:00 2001 From: Zeno Kapitein Date: Mon, 27 Oct 2025 16:17:25 +0100 Subject: [PATCH 1/2] SearchInput fixes - Translate Clear button label - Fix clear button not showing correctly on bold theme - Add `Esc` keyboard shortcut - Remove redundant keyboard shortcut logic in SearchInput in favour of the generic `KeyboardShortcut` --- .changeset/cold-dancers-buy.md | 5 ++ .../src/components/Search/SearchInput.tsx | 50 +++---------------- packages/gitbook/src/intl/translations/de.ts | 1 + packages/gitbook/src/intl/translations/en.ts | 1 + packages/gitbook/src/intl/translations/es.ts | 1 + packages/gitbook/src/intl/translations/fr.ts | 1 + packages/gitbook/src/intl/translations/it.ts | 1 + packages/gitbook/src/intl/translations/ja.ts | 1 + packages/gitbook/src/intl/translations/nl.ts | 1 + packages/gitbook/src/intl/translations/no.ts | 1 + .../gitbook/src/intl/translations/pt-br.ts | 1 + packages/gitbook/src/intl/translations/ru.ts | 1 + packages/gitbook/src/intl/translations/zh.ts | 1 + 13 files changed, 24 insertions(+), 42 deletions(-) create mode 100644 .changeset/cold-dancers-buy.md diff --git a/.changeset/cold-dancers-buy.md b/.changeset/cold-dancers-buy.md new file mode 100644 index 0000000000..04e8cb5e1e --- /dev/null +++ b/.changeset/cold-dancers-buy.md @@ -0,0 +1,5 @@ +--- +"gitbook": patch +--- + +SearchInput fixes — Translate Clear button, Bold theme color, "Esc" keyboard shortcut diff --git a/packages/gitbook/src/components/Search/SearchInput.tsx b/packages/gitbook/src/components/Search/SearchInput.tsx index 88fa7311be..f84f683784 100644 --- a/packages/gitbook/src/components/Search/SearchInput.tsx +++ b/packages/gitbook/src/components/Search/SearchInput.tsx @@ -1,11 +1,12 @@ 'use client'; import React from 'react'; -import { useEffect, useRef, useState } from 'react'; +import { useEffect, useRef } from 'react'; import { tString, useLanguage } from '@/intl/client'; import { tcls } from '@/lib/tailwind'; import { Icon } from '@gitbook/icons'; import { Button, variantClasses } from '../primitives'; +import { KeyboardShortcut } from '../primitives/KeyboardShortcut'; import { useClassnames } from '../primitives/StyleProvider'; interface SearchInputProps { @@ -79,11 +80,11 @@ export const SearchInput = React.forwardRef( {value && isOpen ? (