Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions frontend/src/components/floating-menus/Dialog.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@
// Focus the button which is marked as emphasized, or otherwise the first button, in the popup
const emphasizedOrFirstButton = (self?.div?.()?.querySelector("[data-emphasized]") || self?.div?.()?.querySelector("[data-text-button]") || undefined) as HTMLButtonElement | undefined;
emphasizedOrFirstButton?.focus();

// Add an event to handle enter press on all focusable fields(inputs) inside the popup
const pop = (self?.div?.()?.querySelector("[data-floating-menu-content]") || self?.div?.()?.querySelector("[data-floating-menu-content]") || undefined) as HTMLButtonElement | undefined;
pop?.addEventListener("keydown", function (event) {
if (event.key == "Enter") {
emphasizedOrFirstButton?.click();
}
})
});
</script>

Expand Down