Skip to content
Closed
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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you look closely at these files

MenuList.svelte:68-75
ColorPicker.svelte:408-410
ScrollbarInput.svelte:201-207

we always have a onDestroy after an onMount , not related to the changes from this PR , but would probably be a good idea to cleanup this stale event handler

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 floatingMenu = (self?.div?.()?.querySelector("[data-floating-menu-content]") || undefined) as HTMLDivElement | undefined;
floatingMenu?.addEventListener("keydown", function (event) {
if (event.key == "Enter") {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT : maybe use === , instead of == , for string comparisons

emphasizedOrFirstButton?.click();
}
});
});
</script>

Expand Down
Loading