Skip to content

Commit

Permalink
fix(search-input): make sure text selection works in search bar (#1001)
Browse files Browse the repository at this point in the history
* fix(search-input): make sure text selection works in search bar

* fix: revert changes to document-view.js

---------

Co-authored-by: Christian Zosel <[email protected]>
  • Loading branch information
MitanOmar and czosel authored Nov 15, 2024
1 parent f7485ce commit 49ff2aa
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions addon/components/search.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
/>
</form>
</div>
9 changes: 9 additions & 0 deletions addon/components/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 } }) => {
Expand Down

0 comments on commit 49ff2aa

Please sign in to comment.