Make the hashtag typing experience slightly better

This commit is contained in:
Lim Chee Aun 2023-03-01 23:39:31 +08:00
parent 563a1ffd9b
commit 37f7c2a581

View file

@ -186,7 +186,7 @@ function Hashtags(props) {
<form <form
onSubmit={(e) => { onSubmit={(e) => {
e.preventDefault(); e.preventDefault();
const newHashtag = e.target[0].value; const newHashtag = e.target[0].value?.trim?.();
// Use includes but need to be case insensitive // Use includes but need to be case insensitive
if ( if (
newHashtag && newHashtag &&
@ -212,8 +212,11 @@ function Hashtags(props) {
reachLimit ? `Max ${TOTAL_TAGS_LIMIT} tags` : 'Add hashtag' reachLimit ? `Max ${TOTAL_TAGS_LIMIT} tags` : 'Add hashtag'
} }
required required
autocorrect="off"
autocapitalize="off"
spellcheck={false}
// no spaces, no hashtags // no spaces, no hashtags
pattern="[^\s#]+" pattern="[^#][^\s#]+[^#]"
disabled={reachLimit} disabled={reachLimit}
/> />
</form> </form>