Fix keyboard submit

This commit is contained in:
Alexis Sellier
2021-05-25 19:09:54 +02:00
parent 19a85b7954
commit 09c4db8cdd
2 changed files with 5 additions and 3 deletions
+4 -2
View File
@@ -14,9 +14,11 @@
import Modal from '@app/Modal.svelte';
function handleKeydown(event: KeyboardEvent) {
// TODO: Fix this when there's a modal.
if (event.key === 'Enter') {
(document.querySelector('button.primary') as HTMLElement).click();
let elems = document.querySelectorAll('button.primary') as NodeListOf<HTMLElement>;
if (elems.length == 1) { // We only allow this when there's one primary button.
elems[0].click();
}
}
}
</script>
+1 -1
View File
@@ -152,7 +152,7 @@
</div>
<div>
{#if isOwner(org)}
<button class="tiny primary" on:click={setName}>
<button class="tiny secondary" on:click={setName}>
Set
</button>
{/if}