From 49ff2aa32ae320538da5ce0c2b67ab5e6f914180 Mon Sep 17 00:00:00 2001 From: Mitan Omar Date: Fri, 15 Nov 2024 17:25:51 +0300 Subject: [PATCH] fix(search-input): make sure text selection works in search bar (#1001) * fix(search-input): make sure text selection works in search bar * fix: revert changes to document-view.js --------- Co-authored-by: Christian Zosel --- addon/components/search.hbs | 2 ++ addon/components/search.js | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/addon/components/search.hbs b/addon/components/search.hbs index 761322ee..5163ed22 100644 --- a/addon/components/search.hbs +++ b/addon/components/search.hbs @@ -12,6 +12,8 @@ aria-label={{t "alexandria.search"}} data-test-search-input {{on "input" this.updateSearch.perform}} + {{on "focus" this.onFocus}} + {{on "focusout" this.onFocusOut}} /> \ No newline at end of file diff --git a/addon/components/search.js b/addon/components/search.js index c47cdeda..8f39c64b 100644 --- a/addon/components/search.js +++ b/addon/components/search.js @@ -6,11 +6,20 @@ import { timeout, task } from "ember-concurrency"; export default class SearchComponent extends Component { @service router; + @service("alexandria-documents") documents; @action onSubmit(event) { event.preventDefault(); } + @action onFocus() { + this.documents.disableShortcuts(); + } + + @action onFocusOut() { + this.documents.enableShortcuts(); + } + updateSearch = task( { restartable: true }, async ({ target: { value: search } }) => {