Use keypress handler instead of reordering DOM elements
Co-authored-by: 0ski <1408674+0ski@users.noreply.github.com>
This commit is contained in:
committed by
Oskar Otwinowski
parent
8e4db5b4cb
commit
f17de1e59f
@@ -12,11 +12,11 @@ export function FormButtons({
|
||||
return (
|
||||
<div
|
||||
className={cn(
|
||||
"flex w-full flex-row-reverse items-center justify-between border-t border-grid-bright pt-4",
|
||||
"flex w-full items-center justify-between border-t border-grid-bright pt-4",
|
||||
className
|
||||
)}
|
||||
>
|
||||
{confirmButton} {cancelButton ? cancelButton : <div />}
|
||||
{cancelButton ? cancelButton : <div />} {confirmButton}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
+18
-1
@@ -953,6 +953,18 @@ function QueueOverrideConcurrencyButton({
|
||||
navigation.formData?.get("action") === "queue-remove-override"
|
||||
);
|
||||
|
||||
const handleKeyDown = (e: React.KeyboardEvent<HTMLFormElement>) => {
|
||||
if (e.key === "Enter" && !e.shiftKey && !e.ctrlKey && !e.metaKey && !e.altKey) {
|
||||
e.preventDefault();
|
||||
const overrideButton = e.currentTarget.querySelector(
|
||||
'button[name="action"][value="queue-override"]'
|
||||
) as HTMLButtonElement;
|
||||
if (overrideButton && !overrideButton.disabled) {
|
||||
overrideButton.click();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<Dialog open={isOpen} onOpenChange={setIsOpen}>
|
||||
<DialogTrigger asChild>
|
||||
@@ -983,7 +995,12 @@ function QueueOverrideConcurrencyButton({
|
||||
set {queue.concurrencyLimit !== null ? "in code" : "by the environment"}.
|
||||
</Paragraph>
|
||||
)}
|
||||
<Form method="post" onSubmit={() => setIsOpen(false)} className="space-y-3">
|
||||
<Form
|
||||
method="post"
|
||||
onSubmit={() => setIsOpen(false)}
|
||||
onKeyDown={handleKeyDown}
|
||||
className="space-y-3"
|
||||
>
|
||||
<input type="hidden" name="friendlyId" value={queue.id} />
|
||||
<div className="space-y-2">
|
||||
<label htmlFor="concurrencyLimit" className="text-sm text-text-bright">
|
||||
|
||||
Reference in New Issue
Block a user