| author | |
| committer | |
| log | dfbda843628c817a48523b1a4a28a6ef232d1d65 |
| tree | 06d550e17300cbb05f6693664838bcd0f1eafcf7 |
| parent | 78485e6d50d06180618aacd0d25151e831f666a4 |
| signature | Signed by PGP key B5690EEEBB952194 |
2 files changed, 11 insertions(+), 2 deletions(-)
apps/web/src/components/AppSidebarLayout.tsx+9-2| ... | ... | @@ -33,6 +33,12 @@ function SidebarControl() { |
| 33 | 33 | useEffect(() => { |
| 34 | 34 | const onKeyDown = (event: KeyboardEvent) => { |
| 35 | 35 | if (event.defaultPrevented) return; |
| 36 | if ( | |
| 37 | event.target instanceof HTMLElement && | |
| 38 | event.target.closest("[data-keybinding-capture]") | |
| 39 | ) { | |
| 40 | return; | |
| 41 | } | |
| 36 | 42 | if (resolveShortcutCommand(event, keybindings) !== "sidebar.toggle") return; |
| 37 | 43 | |
| 38 | 44 | event.preventDefault(); |
| ... | ... | @@ -40,8 +46,9 @@ function SidebarControl() { |
| 40 | 46 | toggleSidebar(); |
| 41 | 47 | }; |
| 42 | 48 | |
| 43 | window.addEventListener("keydown", onKeyDown); | |
| 44 | return () => window.removeEventListener("keydown", onKeyDown); | |
| 49 | // Capture before focused editors consume commands such as Mod+B for rich-text formatting. | |
| 50 | window.addEventListener("keydown", onKeyDown, true); | |
| 51 | return () => window.removeEventListener("keydown", onKeyDown, true); | |
| 45 | 52 | }, [keybindings, toggleSidebar]); |
| 46 | 53 | |
| 47 | 54 | return ( |
apps/web/src/components/settings/KeybindingsSettings.tsx+2| ... | ... | @@ -846,6 +846,7 @@ function KeybindingTableRow({ |
| 846 | 846 | </button> |
| 847 | 847 | ) : ( |
| 848 | 848 | <Input |
| 849 | data-keybinding-capture="" | |
| 849 | 850 | autoFocus={isRecording} |
| 850 | 851 | aria-label={`Keybinding for ${commandLabel(row.command)}`} |
| 851 | 852 | value={isRecording ? "" : keyDraft} |
| ... | ... | @@ -1011,6 +1012,7 @@ function NewKeybindingTableRow({ |
| 1011 | 1012 | </div> |
| 1012 | 1013 | <div className="flex min-w-0 items-center gap-2 pr-4"> |
| 1013 | 1014 | <Input |
| 1015 | data-keybinding-capture="" | |
| 1014 | 1016 | aria-label={`Keybinding for ${commandLabelText}`} |
| 1015 | 1017 | value={isRecording ? "" : keyDraft} |
| 1016 | 1018 | placeholder={isRecording ? "Press shortcut" : "Unassigned"} |