Skip to content

πŸ™Œ OpenHands: AI-Driven Development

fix: fit Edit backend dialog to small viewports (#18219)

Engel Nyst9cf01bb59390
diff --git a/.agents/skills/verify-openhands/references/feature-map/F25-backends-and-cloud.md b/.agents/skills/verify-openhands/references/feature-map/F25-backends-and-cloud.md
index de188e9c3d..e652ffcfec 100644
--- a/.agents/skills/verify-openhands/references/feature-map/F25-backends-and-cloud.md
+++ b/.agents/skills/verify-openhands/references/feature-map/F25-backends-and-cloud.md
@@ -35,7 +35,7 @@ Source: `src/components/features/backends/`, `src/contexts/active-backend-contex
- `F25.recovery-gate`: reloading while the active backend is down shows only `agent-server-onboarding-screen` with Manage backends in recovery mode (no X, no Done, Escape ignored, primary **Add Backend**); choosing a healthy row restores the app.
- `F25.remove-backend`: the trash icon asks `Remove backend "<name>"? If it is active, the app will switch back to Local.`; Cancel keeps it, Confirm removes it and an active removed backend falls back to Local (BM-003).
- `F25.collapsed-entry`: with the rail collapsed, the backend icon's popover offers the same Add Backend and Manage Backends items, and both modals open.
-- `F25.phone`: at 390 px the drawer's selector opens both modals inside the viewport without horizontal overflow.
+- `F25.phone`: at 390 px the drawer's selector opens Add and Manage inside the viewport without horizontal overflow. Edit backend fits at 320 and 390 px; on short viewports its form scrolls while the title and close control stay visible, and Cancel/Save remain reachable.
- `F25.device-verify-page`: `/oauth/device/verify` shows a "Device Authorization" code form; with `?user_code=` it shows "Device Authorization Request", the code, a Security Notice and Cancel / Authorize Device. On a local stack Authorize and Continue end in the `Error` card with **Try Again**.
- `F25.shared-conversation-view`: `/shared/conversations/<id>` is a standalone read-only page (no app shell); on a local backend it reads `Conversation not found`.
- `F25.share-publicly`: on a Cloud backend the conversation menu has a **Public Share** toggle with copy-link and open-link buttons; on a local backend the item is absent.
@@ -89,7 +89,7 @@ Preconditions:
- **Remove the active backend (`F25.remove-backend`).** Run `control-openhands restart --run "$OH_VERIFY_RUN_2"`, `browser click 'testid=backend-selector'`, `browser wait 'testid=backend-selector >> role=option[name="Connected QA_Renamed"]' --timeout 25000` and click that option (selector reads `QA_Renamed`). Open Manage Backends, `control-openhands browser click 'testid=manage-backends-remove-QA_Renamed'`; `browser text 'testid=confirmation-modal'` reads `Remove backend "QA_Renamed"? If it is active, the app will switch back to Local.` `control-openhands browser click 'testid=confirmation-modal >> role=button[name="Cancel"]'` keeps the row (`count 'testid=manage-backends-row-QA_Renamed'` `1`). Click the trash again, then `control-openhands browser click 'testid=confirmation-modal >> testid=confirm-button'`: the row count is `0`. Click Done and `browser reload`: the selector reads `Local`, `browser count 'testid=backend-selector >> role=option'` (dropdown open) is `1`, and the card count is `1`.
- **Add from Manage, Edit Cancel and X (`F25.manage-add`, `F25.edit-cancel`).** The second stack is running again after the previous bullet. Run `browser goto /conversations/<id>`, `browser wait 'testid=chat-interface'`, open the selector, click `manage-backends-menu-item`, then `control-openhands browser click 'testid=manage-backends-add'` and `control-openhands browser wait 'testid=add-backend-modal' --timeout 5000` (`visible`); `browser count 'testid=manage-backends-modal'` is `1` underneath. `browser click 'testid=add-backend-close'`: the Add count is `0` and the Manage count stays `1`. Click `manage-backends-add` again, `add-backend-option-agent-server`, fill `add-backend-name` with `QA_Second`, `add-backend-host` with `<second-url>` and `add-backend-api-key` with `--value-file "$OH_VERIFY_RUN_2/private/session-key"`, then `browser click 'testid=add-backend-submit' --expect-url '/conversations(\?|$)'`: the URL is `/conversations`, `count 'testid=add-backend-modal'` is `0`, `count 'testid=manage-backends-modal'` is still `1`, `count 'testid=manage-backends-row-QA_Second'` is `1` and the selector reads `QA_Second` (screenshot `--feature F25.manage-add --name after-add`). No consent prompt this time: it is stored on the second backend. Then `control-openhands browser click 'testid=manage-backends-edit-QA_Second'`, `browser fill 'testid=edit-backend-name' QA_Draft` and `control-openhands browser click 'testid=edit-backend-cancel'`: `count 'testid=edit-backend-modal'` `0`, `count 'testid=manage-backends-modal'` `1`, row `QA_Second` `1`, row `QA_Draft` `0`. Repeat with `control-openhands browser click 'testid=edit-backend-close'`: same counts, and reopening the pencil shows `browser value 'testid=edit-backend-name'` `QA_Second`; leave with `edit-backend-cancel`. Remove it again: `browser click 'testid=manage-backends-remove-QA_Second'`, `browser click 'testid=confirmation-modal >> testid=confirm-button'`, `browser click 'testid=manage-backends-done'` and `browser reload`: the selector reads `Local`.
- **Collapsed rail (`F25.collapsed-entry`).** Run `control-openhands browser click 'testid=sidebar-collapse-toggle'` (`attr 'aside[data-collapsed]' data-collapsed` is `true`), `control-openhands browser hover 'testid=collapsed-backend-selector-link'`, `control-openhands browser click 'testid=add-backend-menu-item'` and `control-openhands browser wait 'testid=add-backend-modal' --timeout 5000` (`visible`). Close it, hover again, click `manage-backends-menu-item` and `browser wait 'testid=manage-backends-modal' --timeout 5000`. Close with Done and expand with `browser click 'testid=sidebar-collapse-toggle'`.
-- **Phone (`F25.phone`).** Run `control-openhands browser viewport phone`, `browser goto /conversations`, `control-openhands browser click 'testid=sidebar-mobile-menu-toggle'`, `control-openhands browser click 'testid=sidebar-mobile-drawer >> testid=backend-selector'`, `browser click 'testid=add-backend-menu-item'`, `browser click 'testid=add-backend-option-agent-server'` and `control-openhands browser bbox 'testid=add-backend-modal'`: `insideViewport` `true`, `pageHorizontalOverflow` `false`. Screenshot `--feature F25.phone --name add-modal`. Close it (the drawer stays open), open Manage Backends from the drawer selector the same way and check `bbox 'testid=manage-backends-modal'` the same. Return with `browser viewport desktop`.
+- **Phone (`F25.phone`).** Run `control-openhands browser viewport phone`, `browser goto /conversations`, `control-openhands browser click 'testid=sidebar-mobile-menu-toggle'`, `control-openhands browser click 'testid=sidebar-mobile-drawer >> testid=backend-selector'`, `browser click 'testid=add-backend-menu-item'`, `browser click 'testid=add-backend-option-agent-server'` and `control-openhands browser bbox 'testid=add-backend-modal'`: `insideViewport` `true`, `pageHorizontalOverflow` `false`. Screenshot `--feature F25.phone --name add-modal`. Close it (the drawer stays open), open Manage Backends from the drawer selector the same way and check `bbox 'testid=manage-backends-modal'` the same. Click `testid=manage-backends-edit-Local` and check `bbox 'testid=edit-backend-modal'`: `insideViewport` `true`; repeat at `browser viewport 320x568`. At `browser viewport 320x400`, clear `edit-backend-name`, fill `edit-backend-host` with `not a host` and focus `edit-backend-api-key` to show both validation messages. Run `browser scroll 'testid=edit-backend-form' --by 600`: Cancel and Save must come into view while the title and `edit-backend-close` stay visible. Check the modal and all three controls with `bbox`, then close with Cancel. Return with `browser viewport desktop`; reopen Edit and confirm its width is still 520px.
- **Device verify page (`F25.device-verify-page`).** Run `control-openhands browser goto /oauth/device/verify` and `browser snapshot`: heading `Device Authorization`, `Enter the code displayed on your device:`, textbox `Device Code:` and button `Continue`, inside the normal app shell. `control-openhands browser fill 'role=textbox[name="Device Code:"]' QA-0000` and `browser click 'role=button[name="Continue"]'` go straight to the result: heading `Error`, `Failed to authorize device. Please try again.`, button `Try Again`; `browser network --filter verify-authenticated` shows `POST /oauth/device/verify-authenticated` `404`. Then `control-openhands browser goto '/oauth/device/verify?user_code=QA-0000'`: heading `Device Authorization Request`, `DEVICE CODE`, `QA-0000`, `Security Notice`, buttons `Cancel` and `Authorize Device` (screenshot `--feature F25.device-verify-page --name with-code`). `browser click 'role=button[name="Cancel"]'` does nothing in a tab the page did not open (URL unchanged). `browser click 'role=button[name="Authorize Device"]'` and `browser wait 'role=heading[name="Error"]'` show the same Error card; **Try Again** reloads to the request.
- **Shared view (`F25.shared-conversation-view`).** Run `control-openhands browser goto /shared/conversations/<id>` and `control-openhands browser wait-text 'Conversation not found' --timeout 15000`. The page has no sidebar; `browser network --filter shared` shows `GET /api/shared-conversations` and `/api/shared-events/search` `404`. Screenshot `--feature F25.shared-conversation-view --name local-not-found`.
- **No Public Share locally (`F25.share-publicly`).** Run `browser goto /conversations/<id>`, `control-openhands browser click 'testid=conversation-name >> testid=ellipsis-button'` and `control-openhands browser count 'testid=share-publicly-button'`: `0` on a local backend (`browser testids --filter button` lists `rename-button`, `show-skills-button`, `show-agent-tools-button`, `export-transcript-button`, `download-trajectory-button`, `display-cost-button` and `delete-button`; `show-hooks-button` and `stop-button` appear only while the conversation is active (idle, running, waiting for confirmation or finished), so a paused or errored conversation has neither). The toggle, `copy-share-link-button` and `open-share-link-button` need a Cloud backend: blocked.
diff --git a/__tests__/components/backends/backend-form-modal.test.tsx b/__tests__/components/backends/backend-form-modal.test.tsx
index f2ee4c46bd..ca1a0e711c 100644
--- a/__tests__/components/backends/backend-form-modal.test.tsx
+++ b/__tests__/components/backends/backend-form-modal.test.tsx
@@ -14,6 +14,10 @@ import {
type NavigationContextValue,
} from "#/context/navigation-context";
import { BackendFormModal } from "#/components/features/backends/backend-form-modal";
+import {
+ MODAL_MAX_WIDTH_VIEWPORT,
+ MODAL_WIDTH_CLASS,
+} from "#/components/shared/modals/modal-body";
const getServerInfoMock = vi.hoisted(() => vi.fn());
const getSettingsMock = vi.hoisted(() => vi.fn().mockResolvedValue({}));
@@ -82,6 +86,43 @@ afterEach(() => {
});
describe("BackendFormModal – edit mode (BackendForm entry point)", () => {
+ it("bounds the edit dialog to the viewport with its close control outside the scrollable form", () => {
+ renderWithProviders(
+ <BackendFormModal
+ mode="edit"
+ backend={{
+ id: "seeded-id",
+ name: "My Server",
+ host: "http://localhost:9000",
+ apiKey: "",
+ kind: "local",
+ }}
+ onClose={vi.fn()}
+ />,
+ );
+
+ const dialog = screen.getByTestId("edit-backend-modal");
+ expect(dialog).toHaveClass(
+ MODAL_WIDTH_CLASS.md,
+ MODAL_MAX_WIDTH_VIEWPORT,
+ "max-h-[92dvh]",
+ );
+
+ const scrollRegion = screen
+ .getByTestId("edit-backend-form")
+ .closest(".overflow-y-auto");
+ expect(scrollRegion).toHaveClass("min-h-0");
+ expect(scrollRegion).toContainElement(
+ screen.getByTestId("edit-backend-cancel"),
+ );
+ expect(scrollRegion).toContainElement(
+ screen.getByTestId("edit-backend-submit"),
+ );
+ expect(scrollRegion).not.toContainElement(
+ screen.getByTestId("edit-backend-close"),
+ );
+ });
+
it("pre-fills fields with the backend data passed as prop", () => {
renderWithProviders(
<BackendFormModal
diff --git a/src/components/features/backends/backend-form-modal.tsx b/src/components/features/backends/backend-form-modal.tsx
index cccc2e3469..b906a5c031 100644
--- a/src/components/features/backends/backend-form-modal.tsx
+++ b/src/components/features/backends/backend-form-modal.tsx
@@ -1585,7 +1585,7 @@ export function BackendFormModal({
);
}
- // Edit mode β€” single-column form (unchanged)
+ // Edit mode β€” keep the header visible while a tall form scrolls.
const testIdRoot = "edit-backend";
return (
<ModalBackdrop
@@ -1596,20 +1596,23 @@ export function BackendFormModal({
<div
data-testid={`${testIdRoot}-modal`}
className={cn(
- "relative bg-base-secondary p-6 rounded-xl flex flex-col gap-4 border border-border",
+ "relative max-h-[92dvh] bg-base-secondary p-6 rounded-xl flex flex-col gap-4 border border-border",
modalWidthClassName("md"),
+ MODAL_MAX_WIDTH_VIEWPORT,
)}
>
<ModalCloseButton onClose={onClose} testId={`${testIdRoot}-close`} />
- <h2 className={cn("pr-6", modalTitleLgClassName)}>
+ <h2 className={cn("shrink-0 pr-6", modalTitleLgClassName)}>
{t(I18nKey.BACKEND$EDIT_TITLE)}
</h2>
- <BackendForm
- mode="edit"
- backend={backend}
- onSubmitted={onClose}
- testIdRoot={testIdRoot}
- />
+ <div className="min-h-0 overflow-y-auto">
+ <BackendForm
+ mode="edit"
+ backend={backend}
+ onSubmitted={onClose}
+ testIdRoot={testIdRoot}
+ />
+ </div>
</div>
</ModalBackdrop>
);