fix(web): disable the enlarge button along with its field
Copilot review round 2 on #2109. A disabled form (a tool call in flight) left the enlarge button live, and activating it swapped in a text area that mounts disabled — so the focus hand-off targeted an unfocusable element and keyboard focus was dropped to the document. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JTHVxSu8AUgHRLvo1ntZ8H Signed-off-by: cliffhall <cliff@futurescale.com>
This commit is contained in:
parent
925ff4de2f
commit
7db596b5e6
2 changed files with 42 additions and 2 deletions
|
|
@ -1954,4 +1954,19 @@ describe("SchemaForm multiline strings (#2042)", () => {
|
|||
await user.keyboard("{Enter}more");
|
||||
expect(textarea.value).toBe("typed\nmore");
|
||||
});
|
||||
|
||||
// A disabled form (a tool call in flight) must be inert as a whole: a live
|
||||
// button there would swap in a text area that mounts disabled, cannot take
|
||||
// focus, and so drops keyboard focus to the document.
|
||||
it("disables the enlarge button along with the field", () => {
|
||||
renderWithMantine(
|
||||
<SchemaForm
|
||||
schema={stringSchema}
|
||||
values={{}}
|
||||
onChange={vi.fn()}
|
||||
disabled
|
||||
/>,
|
||||
);
|
||||
expect(screen.getByRole("button", { name: "Enlarge Note" })).toBeDisabled();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -713,6 +713,7 @@ export function SchemaForm({
|
|||
<FieldActions>
|
||||
<EnlargeButton
|
||||
ariaLabel={`Enlarge ${label}`}
|
||||
disabled={disabled}
|
||||
onClick={() =>
|
||||
setEnlargedFields(
|
||||
(previous) => new Set([...previous, fieldName]),
|
||||
|
|
|
|||
Loading…
Reference in a new issue