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