fix: let Enter through when the message box's suggestion list has nothing to show (#31506)

This commit is contained in:
G30 2026-09-27 22:15:56 -04:00 • committed by GitHub
parent 82b5181372
commit c8a3e10e13
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -55,6 +55,7 @@
const onKeyDown = (event: KeyboardEvent) => {
if (!['ArrowUp', 'ArrowDown', 'Enter', 'Tab', 'Escape'].includes(event.key)) return false;
if ((filteredItems ?? []).length === 0) return false;
if (event.key === 'ArrowUp') {
suggestionElement?.selectUp();
@ -89,7 +90,10 @@
}
</script>
<div class={(filteredItems ?? []).length > 0 ? '' : 'hidden'} id="suggestions-container">
<div
class={(filteredItems ?? []).length > 0 ? '' : 'hidden'}
id={(filteredItems ?? []).length > 0 ? 'suggestions-container' : undefined}
>
<DropdownMenu className="w-72 max-w-[calc(100vw-1rem)] overflow-x-hidden font-sans text-xs">
<div class="max-h-60 overflow-y-auto overflow-x-hidden scrollbar-thin">
{#if char === '/'}