diff --git a/src/snek/static/chat-input.js b/src/snek/static/chat-input.js index 1ea2c2e..661bf8b 100644 --- a/src/snek/static/chat-input.js +++ b/src/snek/static/chat-input.js @@ -27,10 +27,12 @@ class ChatInputElement extends HTMLElement { button.disabled = !message; }) this.textBox.addEventListener('change', (e) => { + e.preventDefault() this.dispatchEvent(new CustomEvent("change", { detail: e.target.value, bubbles: true })) console.error(e.target.value) }) this.textBox.addEventListener('keyup', (e) => { + e.preventDefault() if (e.key == 'Enter' && !e.shiftKey) { this.dispatchEvent(new CustomEvent("submit", { detail: e.target.value, bubbles: true })) e.target.value = '' @@ -47,4 +49,4 @@ class ChatInputElement extends HTMLElement { this.component.appendChild(this.container) } } -customElements.define('chat-input', ChatInputElement); \ No newline at end of file +customElements.define('chat-input', ChatInputElement);