Skip to content

Commit 1dc83ca

Browse files
committed
Fix node catalog preserving type search on autofocus
1 parent 97f8113 commit 1dc83ca

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

frontend/src/components/floating-menus/NodeCatalog.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@
113113
</script>
114114

115115
<LayoutCol class="node-catalog">
116-
<TextInput placeholder="Search Nodes…" value={searchTerm} on:value={({ detail }) => (searchTerm = detail)} bind:this={nodeSearchInput} />
116+
<TextInput placeholder="Search Nodes…" value={searchTerm} on:value={({ detail }) => (searchTerm = detail)} selectAllOnFocus={false} bind:this={nodeSearchInput} />
117117
<div class="list-results" on:wheel|passive|stopPropagation>
118118
{#each nodeCategories as nodeCategory}
119119
<details open={nodeCategory[1].open}>

frontend/src/components/widgets/inputs/TextInput.svelte

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@
1616
// Sizing
1717
export let minWidth = 0;
1818
export let maxWidth = 0;
19-
// Tooltips
19+
// Tooltips
2020
export let tooltipLabel: string | undefined = undefined;
2121
export let tooltipDescription: string | undefined = undefined;
2222
export let tooltipShortcut: ActionShortcut | undefined = undefined;
23+
// Behavior
24+
export let selectAllOnFocus = true;
2325
2426
let className = "";
2527
export { className as class };
@@ -28,10 +30,10 @@
2830
let self: FieldInput | undefined;
2931
let editing = false;
3032
31-
function onTextFocused() {
33+
function onTextFocused() {
3234
editing = true;
3335
34-
self?.selectAllText(value);
36+
if (selectAllOnFocus) self?.selectAllText(value);
3537
}
3638
3739
// Called only when `value` is changed from the <input> element via user input and committed, either with the

0 commit comments

Comments
 (0)