mirror of
https://github.com/open-webui/open-webui.git
synced 2026-10-29 06:32:52 +00:00
fix(a11y): opening the Terminal menu focuses its first terminal, not the Add Terminal button, and the arrow keys move through the terminals (#33153)
This commit is contained in:
parent
d378fe81cb
commit
5cc0ed71d6
2 changed files with 12 additions and 1 deletions
|
|
@ -208,6 +208,8 @@
|
|||
{#each directTerminals as terminal}
|
||||
<button
|
||||
type="button"
|
||||
role="menuitemradio"
|
||||
aria-checked={$selectedTerminalId === terminal.url}
|
||||
class="flex w-full justify-between gap-2 items-center h-[1.6875rem] px-2 text-[0.8125rem] font-normal cursor-pointer rounded-xl {$selectedTerminalId ===
|
||||
terminal.url
|
||||
? 'bg-gray-50/40 dark:bg-gray-800/40'
|
||||
|
|
@ -277,6 +279,8 @@
|
|||
{#each systemTerminals as terminal}
|
||||
<button
|
||||
type="button"
|
||||
role="menuitemradio"
|
||||
aria-checked={$selectedTerminalId === terminal.id}
|
||||
class="flex w-full justify-between gap-2 items-center h-[1.6875rem] px-2 text-[0.8125rem] font-normal cursor-pointer rounded-xl {$selectedTerminalId ===
|
||||
terminal.id
|
||||
? 'bg-gray-50/40 dark:bg-gray-800/40'
|
||||
|
|
|
|||
|
|
@ -258,8 +258,15 @@
|
|||
|
||||
if (shouldFocusContent) {
|
||||
shouldFocusContent = false;
|
||||
const firstControl = contentEl?.querySelector<HTMLElement>(
|
||||
'button:not([disabled]), a[href], input'
|
||||
);
|
||||
(
|
||||
contentEl?.querySelector<HTMLElement>('button:not([disabled]), a[href], input') ?? contentEl
|
||||
(firstControl?.matches('input')
|
||||
? firstControl
|
||||
: contentEl?.querySelector<HTMLElement>('[role^="menuitem"]:not([disabled])')) ??
|
||||
firstControl ??
|
||||
contentEl
|
||||
)?.focus();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue