disable tags input field autofocus on channel edit and publish form

This commit is contained in:
zxawry 2019-10-24 21:58:37 +01:00 committed by Sean Yesmunt
parent 080a36c5a6
commit 2989ef6f7b
4 changed files with 9 additions and 2 deletions

View file

@ -185,6 +185,7 @@ function ChannelForm(props: Props) {
<TagsSelect
title={__('Add Tags')}
suggestMature
disableAutoFocus
help={__('The better your tags are, the easier it will be for people to discover your channel.')}
empty={__('No tags added')}
placeholder={__('Add a tag')}

View file

@ -138,6 +138,7 @@ function PublishForm(props: Props) {
<TagsSelect
title={__('Add Tags')}
suggestMature
disableAutoFocus
help={__('The better your tags are, the easier it will be for people to discover your content.')}
empty={__('No tags added')}
placeholder={__('Add a tag')}

View file

@ -12,6 +12,7 @@ type Props = {
doAddTag: string => void,
onSelect?: Tag => void,
suggestMature?: boolean,
disableAutoFocus?: boolean,
onRemove: Tag => void,
placeholder?: string,
};
@ -33,6 +34,7 @@ export default function TagsSearch(props: Props) {
onSelect,
onRemove,
suggestMature,
disableAutoFocus,
placeholder,
} = props;
const [newTag, setNewTag] = useState('');
@ -118,7 +120,7 @@ export default function TagsSearch(props: Props) {
))}
<li>
<FormField
autoFocus
autoFocus={!disableAutoFocus}
className="tag__input"
onChange={onChange}
placeholder={placeholder || __('Follow more tags')}

View file

@ -21,6 +21,7 @@ type Props = {
onSelect?: (Array<Tag>) => void,
onRemove?: Tag => void,
placeholder?: string,
disableAutoFocus?: boolean,
};
/*
@ -37,6 +38,7 @@ export default function TagsSelect(props: Props) {
onSelect,
onRemove,
suggestMature,
disableAutoFocus,
placeholder,
} = props;
const [hasClosed, setHasClosed] = usePersistedState('tag-select:has-closed', false);
@ -92,7 +94,8 @@ export default function TagsSelect(props: Props) {
onRemove={handleTagClick}
onSelect={onSelect}
suggestMature={suggestMature && !hasMatureTag}
tagsPassedIn={tagsToDisplay}
disableAutoFocus={disableAutoFocus}
tagsPasssedIn={tagsToDisplay}
placeholder={placeholder}
/>
</React.Fragment>