mirror of
https://github.com/open-webui/open-webui.git
synced 2026-10-11 03:38:02 +00:00
fix: closing Settings opened from the user menu loses the keyboard focus (#32185)
Picking Settings from the user menu with the keyboard left the focus on the menu item, which disappears as the menu closes. When Settings closed, the focus went back to that removed item, so it was lost and the next Tab started over at the top of the page. The menu now gives the focus back to the user menu button when it closes after an item is picked, the same as when it is closed with Escape, so closing Settings returns there. Fixes #32017
This commit is contained in:
parent
6faf540310
commit
c7e7dbf984
1 changed files with 9 additions and 0 deletions
|
|
@ -275,6 +275,13 @@
|
|||
previouslyFocused = null;
|
||||
}
|
||||
|
||||
function restoreFocusAfterClose() {
|
||||
if (contentEl?.contains(document.activeElement) && previouslyFocused?.isConnected) {
|
||||
previouslyFocused.focus();
|
||||
}
|
||||
previouslyFocused = null;
|
||||
}
|
||||
|
||||
function toggleOpen() {
|
||||
if (show) {
|
||||
closeDropdown();
|
||||
|
|
@ -286,6 +293,8 @@
|
|||
// React to external show changes (e.g. bind:show toggled by parent component)
|
||||
$: if (show) {
|
||||
afterOpen();
|
||||
} else {
|
||||
restoreFocusAfterClose();
|
||||
}
|
||||
|
||||
function handleWindowClick(event: MouseEvent) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue