From a6852085c32cbaee7b10120ee5e730e0f32b0a38 Mon Sep 17 00:00:00 2001 From: trickypr <23250792+trickypr@users.noreply.github.com> Date: Sat, 20 Jan 2024 19:14:13 +1100 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=B8=20User=20experience=20fixes=20(#52?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/content/src/browser/browser.ts | 1 + .../browser/components/omnibox/Omnibox.svelte | 19 +++++-- apps/content/src/browser/lib/window/tab.ts | 9 ++- apps/content/src/browser/lib/window/tabs.ts | 55 +++++++++++-------- .../shared/search/providers/EngineProvider.ts | 2 + .../shared/search/providers/URLProvider.ts | 1 + .../shared/search/providers/EngineProvider.ts | 18 ++++++ libs/link/types/globals/Elements.d.ts | 2 + libs/shared/src/utilities/fn.ts | 8 +++ libs/shared/src/utilities/index.ts | 2 + libs/shared/src/utilities/ring.ts | 24 ++++++++ 11 files changed, 110 insertions(+), 31 deletions(-) create mode 100644 libs/shared/src/utilities/fn.ts create mode 100644 libs/shared/src/utilities/ring.ts diff --git a/apps/content/src/browser/browser.ts b/apps/content/src/browser/browser.ts index 49cd7d2..2550675 100644 --- a/apps/content/src/browser/browser.ts +++ b/apps/content/src/browser/browser.ts @@ -7,6 +7,7 @@ import 'remixicon/fonts/remixicon.css' import '@shared/styles/window.css' import App from './Browser.svelte' +import './browser.css' import { initializeShortcuts } from './lib/shortcuts' import { initializeWindow } from './lib/window' import './lib/window/api' diff --git a/apps/content/src/browser/components/omnibox/Omnibox.svelte b/apps/content/src/browser/components/omnibox/Omnibox.svelte index 0d7897a..8cce5b6 100644 --- a/apps/content/src/browser/components/omnibox/Omnibox.svelte +++ b/apps/content/src/browser/components/omnibox/Omnibox.svelte @@ -20,6 +20,7 @@ let inputElement: HTMLInputElement let suggestions: Suggestion[] = [] let selectedSuggestion = 0 + let selectionChange = false $: focusedOmnibox = tab.focusedOmnibox $: uri = tab.uri @@ -73,13 +74,16 @@ bind:value={inputContent} on:focusin={() => { focusedOmnibox.set(true) + selectionChange = false generateSuggestions() }} - on:blur|capture={() => - setTimeout(() => { - focusedOmnibox.set(false) - suggestions = [] - }, 100)} + on:blur|capture={() => setTimeout(() => focusedOmnibox.set(false), 100)} + on:mouseup={(_) => { + if (!selectionChange) inputElement.select() + }} + on:selectionchange={() => { + selectionChange = true + }} on:keyup={async (e) => { if (e.key === 'Enter') { focusedOmnibox.set(false) @@ -119,8 +123,8 @@