Skip to content

ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.

Treat an open Select as an editable control

Juan Denis075989f9226d
diff --git a/frontend/src/components/ds/DataTable.jsx b/frontend/src/components/ds/DataTable.jsx
index 6a5e0536..dbdb40a5 100644
--- a/frontend/src/components/ds/DataTable.jsx
+++ b/frontend/src/components/ds/DataTable.jsx
@@ -263,7 +263,9 @@ export function DataTable({
if (!keyboardNav) return undefined;
const onKey = (event) => {
const target = event.target;
- if (target instanceof Element && target.closest('input, textarea, select, [contenteditable="true"], [role="dialog"]')) {
+ // A focused Radix Select (trigger = combobox, open list = listbox)
+ // owns its arrows and Enter, exactly like the native <select> did.
+ if (target instanceof Element && target.closest('input, textarea, select, [role="combobox"], [role="listbox"], [contenteditable="true"], [role="dialog"]')) {
return;
}
if (event.metaKey || event.ctrlKey || event.altKey) return;
diff --git a/frontend/src/services/__tests__/shortcutRegistry.test.mjs b/frontend/src/services/__tests__/shortcutRegistry.test.mjs
index 92a613ac..38da5bd7 100644
--- a/frontend/src/services/__tests__/shortcutRegistry.test.mjs
+++ b/frontend/src/services/__tests__/shortcutRegistry.test.mjs
@@ -29,6 +29,18 @@ test('recognizes typing and contenteditable targets', () => {
assert.equal(isEditableTarget({ tagName: 'div', isContentEditable: false }), false);
});
+test('treats a Radix Select trigger or open list like a native select', () => {
+ // closest() stand-in: matches when the selector names this node's role.
+ const withRole = (tagName, role) => ({
+ tagName,
+ isContentEditable: false,
+ closest: (selector) => (selector.includes(`[role="${role}"]`) ? {} : null),
+ });
+ assert.equal(isEditableTarget(withRole('BUTTON', 'combobox')), true);
+ assert.equal(isEditableTarget(withRole('DIV', 'listbox')), true);
+ assert.equal(isEditableTarget(withRole('BUTTON', 'menuitem')), false);
+});
+
test('dispatches the highest-priority matching command and unregisters cleanly', () => {
const registry = createShortcutRegistry();
const called = [];
diff --git a/frontend/src/services/shortcutRegistry.js b/frontend/src/services/shortcutRegistry.js
index 59b0d7c1..5cf95be2 100644
--- a/frontend/src/services/shortcutRegistry.js
+++ b/frontend/src/services/shortcutRegistry.js
@@ -3,7 +3,10 @@ export const isEditableTarget = (target) => {
const tagName = String(target.tagName || '').toLowerCase();
return target.isContentEditable
|| ['input', 'textarea', 'select'].includes(tagName)
- || Boolean(target.closest?.('[contenteditable="true"]'));
+ // A Radix Select (trigger = combobox, open list = listbox) owns its
+ // keys the way a native <select> did: Escape closes the list, not
+ // whatever page shortcut is bound to Escape.
+ || Boolean(target.closest?.('[contenteditable="true"], [role="combobox"], [role="listbox"]'));
};
export const matchesShortcut = (event, shortcut) => {