From 9397352e98d92d7bd90f43d8cd5963b1ced30484 Mon Sep 17 00:00:00 2001 From: N4taaa Date: Wed, 2 Oct 2024 12:51:19 +0100 Subject: [PATCH] Change Searchbar Keyboard Navigation Attempts to fix #186. Fakes the entire search bar being tab-able with :focus and stops the search button from being able to be selected using tab, in favor of submitting using enter. This approach also keeps the submit button to keep regular UX. --- static-src/styles/forms.scss | 11 ++++++++++- views/index.pug | 4 ++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/static-src/styles/forms.scss b/static-src/styles/forms.scss index 835abf3..44f7853 100644 --- a/static-src/styles/forms.scss +++ b/static-src/styles/forms.scss @@ -163,6 +163,15 @@ button.inline { margin: 0; padding: 8px; border-radius: 8px 0 0 8px; + + &:focus { + outline: none; + } + } + + &:has(input[type="search"]:focus) { + outline: 5px auto Highlight; + outline: 5px auto -webkit-focus-ring-color; } input[type="submit"] { @@ -172,4 +181,4 @@ button.inline { border-radius: 0 8px 8px 0; } } -} \ No newline at end of file +} diff --git a/views/index.pug b/views/index.pug index ac9c991..2692cce 100644 --- a/views/index.pug +++ b/views/index.pug @@ -7,7 +7,7 @@ block content form(action="post") input#query(type="search" name="query" required placeholder="Search for a profile") - input(type="submit" value="Search") + input(type="submit" value="Search" tabindex="-1") section h2 About Keyoxide @@ -60,4 +60,4 @@ block content p a.button.button--donate.button--opencollective(href='https://opencollective.com/keyoxide') - | Donate via OpenCollective \ No newline at end of file + | Donate via OpenCollective