The minimalistic document archiving platform.
feat(command-palette): auto-select input text when reopening with existing query (#1025)
Corentin Thomasset9c6985b51f59
diff --git a/.changeset/pink-baths-worry.md b/.changeset/pink-baths-worry.mdnew file mode 100644index 00000000..d916ceb3--- /dev/null+++ b/.changeset/pink-baths-worry.md@@ -0,0 +1,5 @@+---+"@papra/app": patch+---++When reopening the quick search modal with existing query, the input content is automatically selected to allow easy replacement or editing.diff --git a/apps/papra-client/src/modules/command-palette/command-palette.provider.tsx b/apps/papra-client/src/modules/command-palette/command-palette.provider.tsxindex 50148ef0..4985033c 100644--- a/apps/papra-client/src/modules/command-palette/command-palette.provider.tsx+++ b/apps/papra-client/src/modules/command-palette/command-palette.provider.tsx@@ -52,6 +52,17 @@ export const CommandPaletteProvider: ParentComponent = (props) => {document.removeEventListener('keydown', handleKeyDown);});+ let inputRef: HTMLInputElement | undefined;++ createEffect(on(+ getIsCommandPaletteOpen,+ (isOpen) => {+ if (isOpen && getSearchQuery().length > 0) {+ setTimeout(() => inputRef?.select(), 0);+ }+ },+ ));+const navigate = useNavigate();const { setThemePreference } = useTheme();@@ -144,6 +155,7 @@ export const CommandPaletteProvider: ParentComponent = (props) => {><CommandInput+ ref={inputRef}value={getSearchQuery()}onValueChange={setSearchQuery}placeholder={t('command-palette.search.placeholder')}