1
0
Fork 0
mirror of https://github.com/codex-team/codex.docs.git synced 2025-08-08 15:05:26 +02:00

keyup and keydown replace with input

This commit is contained in:
Umang G. Patel 2022-07-23 18:09:29 +05:30
parent 80d2b9d166
commit dbce38ad67

View file

@ -82,8 +82,7 @@ export default class Sidebar {
className = Sidebar.CSS.sidebarSearchWrapperMac; className = Sidebar.CSS.sidebarSearchWrapperMac;
} }
this.nodes.search.parentElement.classList.add(className); this.nodes.search.parentElement.classList.add(className);
this.nodes.search.addEventListener('keydown', e => this.search(e)); this.nodes.search.addEventListener('input', e => this.search(e));
this.nodes.search.addEventListener('keyup', e => this.search(e));
this.ready(); this.ready();
} }
@ -199,12 +198,13 @@ export default class Sidebar {
if (e.ctrlKey && e.code === 'KeyP') { if (e.ctrlKey && e.code === 'KeyP') {
this.nodes.search.focus(); this.nodes.search.focus();
e.preventDefault(); e.preventDefault();
e.stopImmediatePropagation();
} }
if (this.nodes.search === document.activeElement) { if (this.nodes.search === document.activeElement) {
if (e.code === 'ArrowUp') { if (e.code === 'ArrowUp') {
console.log("up");
} }
if (e.code === 'ArrowDown') { if (e.code === 'ArrowDown') {
console.log("down");
} }
e.stopImmediatePropagation(); e.stopImmediatePropagation();
e.preventDefault(); e.preventDefault();