fix: holding Shift shows the Delete buttons again after a mouse click (#33717)

On the Notes, Models, Prompts, Skills, Tools and Automations pages, holding Shift is the quick-delete shortcut that turns each item's menu button into a Delete button. It stopped working once any button on the page had been clicked, for example after switching Notes to Grid view, and now works again. A menu button reached with the Tab key still stays a menu button while Shift is held, so keyboard users do not delete by accident.

Fixes #33714
This commit is contained in:
Classic298 authored and GitHub committed 2026-11-04 07:05:59 +09:00
1 parent 35d946f276
commit 680202aa88
6 files changed
+66 -24

No files matched your search

+11 -4
View File
@@ -320,11 +320,16 @@
dropzoneElement?.addEventListener('drop', onDrop);
dropzoneElement?.addEventListener('dragleave', onDragLeave);
let keyboardFocusedElement: Element | null = null;
const onFocusIn = (event: FocusEvent) => {
const target = event.target as Element;
keyboardFocusedElement = target.matches(':focus-visible:not(input, textarea)')
? target
: null;
};
const onKeyDown = (event: KeyboardEvent) => {
if (
event.key === 'Shift' &&
!document.activeElement?.matches(':focus-visible:not(input, textarea)')
) {
if (event.key === 'Shift' && document.activeElement !== keyboardFocusedElement) {
shiftKey = true;
openNoteMenuId = null;
}
@@ -340,6 +345,7 @@
shiftKey = false;
};
window.addEventListener('focusin', onFocusIn);
window.addEventListener('keydown', onKeyDown);
window.addEventListener('keyup', onKeyUp);
window.addEventListener('blur', onBlur);
@@ -347,6 +353,7 @@
return () => {
clearTimeout(searchDebounceTimer);
window.removeEventListener('focusin', onFocusIn);
window.removeEventListener('keydown', onKeyDown);
window.removeEventListener('keyup', onKeyUp);
window.removeEventListener('blur', onBlur);
+11 -4
View File
@@ -488,11 +488,16 @@
await tick();
loaded = true;
let keyboardFocusedElement: Element | null = null;
const onFocusIn = (event: FocusEvent) => {
const target = event.target as Element;
keyboardFocusedElement = target.matches(':focus-visible:not(input, textarea)')
? target
: null;
};
const onKeyDown = (event) => {
if (
event.key === 'Shift' &&
!document.activeElement?.matches(':focus-visible:not(input, textarea)')
) {
if (event.key === 'Shift' && document.activeElement !== keyboardFocusedElement) {
shiftKey = true;
}
};
@@ -507,11 +512,13 @@
shiftKey = false;
};
window.addEventListener('focusin', onFocusIn);
window.addEventListener('keydown', onKeyDown);
window.addEventListener('keyup', onKeyUp);
window.addEventListener('blur', onBlur);
return () => {
window.removeEventListener('focusin', onFocusIn);
window.removeEventListener('keydown', onKeyDown);
window.removeEventListener('keyup', onKeyUp);
window.removeEventListener('blur', onBlur);
+11 -4
View File
@@ -351,11 +351,16 @@
openCreateModal();
}
let keyboardFocusedElement: Element | null = null;
const onFocusIn = (event: FocusEvent) => {
const target = event.target as Element;
keyboardFocusedElement = target.matches(':focus-visible:not(input, textarea)')
? target
: null;
};
const onKeyDown = (event: KeyboardEvent) => {
if (
event.key === 'Shift' &&
!document.activeElement?.matches(':focus-visible:not(input, textarea)')
) {
if (event.key === 'Shift' && document.activeElement !== keyboardFocusedElement) {
shiftKey = true;
}
};
@@ -370,6 +375,7 @@
shiftKey = false;
};
window.addEventListener('focusin', onFocusIn);
window.addEventListener('keydown', onKeyDown);
window.addEventListener('keyup', onKeyUp);
window.addEventListener('blur', onBlur);
@@ -377,6 +383,7 @@
return () => {
clearTimeout(searchDebounceTimer);
window.removeEventListener('message', onMessage);
window.removeEventListener('focusin', onFocusIn);
window.removeEventListener('keydown', onKeyDown);
window.removeEventListener('keyup', onKeyUp);
window.removeEventListener('blur', onBlur);
+11 -4
View File
@@ -303,11 +303,16 @@
viewOption = localStorage?.workspaceViewOption || '';
loaded = true;
let keyboardFocusedElement: Element | null = null;
const onFocusIn = (event: FocusEvent) => {
const target = event.target as Element;
keyboardFocusedElement = target.matches(':focus-visible:not(input, textarea)')
? target
: null;
};
const onKeyDown = (event) => {
if (
event.key === 'Shift' &&
!document.activeElement?.matches(':focus-visible:not(input, textarea)')
) {
if (event.key === 'Shift' && document.activeElement !== keyboardFocusedElement) {
shiftKey = true;
}
};
@@ -322,12 +327,14 @@
shiftKey = false;
};
window.addEventListener('focusin', onFocusIn);
window.addEventListener('keydown', onKeyDown);
window.addEventListener('keyup', onKeyUp);
window.addEventListener('blur', onBlur);
return () => {
clearTimeout(searchDebounceTimer);
window.removeEventListener('focusin', onFocusIn);
window.removeEventListener('keydown', onKeyDown);
window.removeEventListener('keyup', onKeyUp);
window.removeEventListener('blur', onBlur);
+11 -4
View File
@@ -299,11 +299,16 @@
await init();
loaded = true;
let keyboardFocusedElement: Element | null = null;
const onFocusIn = (event: FocusEvent) => {
const target = event.target as Element;
keyboardFocusedElement = target.matches(':focus-visible:not(input, textarea)')
? target
: null;
};
const onKeyDown = (event) => {
if (
event.key === 'Shift' &&
!document.activeElement?.matches(':focus-visible:not(input, textarea)')
) {
if (event.key === 'Shift' && document.activeElement !== keyboardFocusedElement) {
shiftKey = true;
}
};
@@ -318,12 +323,14 @@
shiftKey = false;
};
window.addEventListener('focusin', onFocusIn);
window.addEventListener('keydown', onKeyDown);
window.addEventListener('keyup', onKeyUp);
window.addEventListener('blur', onBlur);
return () => {
clearTimeout(searchDebounceTimer);
window.removeEventListener('focusin', onFocusIn);
window.removeEventListener('keydown', onKeyDown);
window.removeEventListener('keyup', onKeyUp);
window.removeEventListener('blur', onBlur);
+11 -4
View File
@@ -324,11 +324,16 @@
loaded = true;
ensureChannels();
let keyboardFocusedElement: Element | null = null;
const onFocusIn = (event: FocusEvent) => {
const target = event.target as Element;
keyboardFocusedElement = target.matches(':focus-visible:not(input, textarea)')
? target
: null;
};
const onKeyDown = (event: KeyboardEvent) => {
if (
event.key === 'Shift' &&
!document.activeElement?.matches(':focus-visible:not(input, textarea)')
) {
if (event.key === 'Shift' && document.activeElement !== keyboardFocusedElement) {
shiftKey = true;
openAutomationMenuId = null;
}
@@ -344,6 +349,7 @@
shiftKey = false;
};
window.addEventListener('focusin', onFocusIn);
window.addEventListener('keydown', onKeyDown);
window.addEventListener('keyup', onKeyUp);
window.addEventListener('blur', onBlur);
@@ -351,6 +357,7 @@
return () => {
clearTimeout(searchDebounceTimer);
window.removeEventListener('focusin', onFocusIn);
window.removeEventListener('keydown', onKeyDown);
window.removeEventListener('keyup', onKeyUp);
window.removeEventListener('blur', onBlur);