Skip to content

Commit

Permalink
Merge branch 'preview-fixes'
Browse files Browse the repository at this point in the history
  • Loading branch information
the1812 committed Feb 20, 2024
2 parents fdc05db + 60b427f commit c5852f8
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions registry/lib/components/utils/keymap/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,18 @@ export const builtInActions: Record<string, KeyBindingAction> = {
if (!activeElement || !(activeElement instanceof HTMLTextAreaElement)) {
return null
}
const sendButton = (activeElement.nextElementSibling ??
activeElement.parentElement.nextElementSibling) as HTMLButtonElement
const sendButton = (() => {
const candidates = [
() => activeElement.nextElementSibling,
() => activeElement.parentElement.nextElementSibling,
() => dq('.reply-box:focus-within .reply-box-send'),
]
const match = candidates.find(fn => fn() !== null)
if (match) {
return match() as HTMLElement
}
return null
})()
if (!sendButton) {
return null
}
Expand Down

0 comments on commit c5852f8

Please sign in to comment.