Skip to content

TagSpaces is an offline, open source, document manager with tagging support

fix: autofocus in tagging dialog #1320 (#1361)

Ilian3ba0ce8cc2ec
diff --git a/app/components/TagsSelect.tsx b/app/components/TagsSelect.tsx
index 21d2e5c8e..4b081eed7 100644
--- a/app/components/TagsSelect.tsx
+++ b/app/components/TagsSelect.tsx
@@ -79,6 +79,7 @@ interface Props {
isReadOnlyMode?: boolean;
placeholderText?: string;
selectedEntryPath?: string;
+ autoFocus?: boolean;
// removeTags: (paths: Array<string>, tags: Array<Tag>) => void;
}
@@ -139,7 +140,8 @@ const TagsSelect = (props: Props) => {
placeholderText = '',
label,
tagMode,
- selectedEntryPath
+ selectedEntryPath,
+ autoFocus = false
} = props;
const tags = props.tags ? props.tags : [];
@@ -203,6 +205,7 @@ const TagsSelect = (props: Props) => {
label={label}
placeholder={placeholderText}
margin="normal"
+ autoFocus={autoFocus}
style={{ marginTop: 0, marginBottom: 0, whiteSpace: 'nowrap' }}
fullWidth
/>
diff --git a/app/components/dialogs/AddRemoveTagsDialog.tsx b/app/components/dialogs/AddRemoveTagsDialog.tsx
index b637a2c07..c7b5dc56a 100644
--- a/app/components/dialogs/AddRemoveTagsDialog.tsx
+++ b/app/components/dialogs/AddRemoveTagsDialog.tsx
@@ -127,6 +127,7 @@ const AddRemoveTagsDialog = (props: Props) => {
tags={newlyAddedTags}
handleChange={handleChange}
tagMode="remove"
+ autoFocus={true}
/>
<List dense style={{ width: 550 }}>
{selectedEntries.length > 0 &&