Skip to content

πŸ™Œ OpenHands: AI-Driven Development

fix: keep modal open on errant outside click (#1100)

Hiep Ledb4053037022
diff --git a/__tests__/components/onboarding/onboarding-modal.test.tsx b/__tests__/components/onboarding/onboarding-modal.test.tsx
index 2d2a009324..49b9a43c54 100644
--- a/__tests__/components/onboarding/onboarding-modal.test.tsx
+++ b/__tests__/components/onboarding/onboarding-modal.test.tsx
@@ -286,6 +286,26 @@ describe("OnboardingModal", () => {
expect(onClose).toHaveBeenCalledTimes(1);
});
+ it("stays open when the user clicks outside it or presses Escape", async () => {
+ // Arrange
+ const onClose = vi.fn();
+ renderModal(onClose);
+ const user = userEvent.setup();
+
+ // Act: errant interactions outside the modal box β€” click the dark
+ // backdrop overlay, then press Escape.
+ const backdrop = screen.getByRole("dialog")
+ .firstElementChild as HTMLElement;
+ await user.click(backdrop);
+ await user.keyboard("{Escape}");
+
+ // Assert: neither dismisses the flow nor marks onboarding completed
+ // (https://github.com/OpenHands/agent-canvas/issues/1085); the modal
+ // only closes via explicit actions (Skip / launch).
+ expect(onClose).not.toHaveBeenCalled();
+ expect(screen.getByTestId("onboarding-modal")).toBeInTheDocument();
+ });
+
it("wraps the slide rail in a dedicated scroll region so the modal chrome stays put", () => {
// Arrange + act: render the modal once.
renderModal();
diff --git a/src/components/features/onboarding/onboarding-modal.tsx b/src/components/features/onboarding/onboarding-modal.tsx
index 99ccca8262..bf5a5f8fc8 100644
--- a/src/components/features/onboarding/onboarding-modal.tsx
+++ b/src/components/features/onboarding/onboarding-modal.tsx
@@ -108,11 +108,10 @@ export function OnboardingModal({ onClose }: OnboardingModalProps) {
);
return (
- <ModalBackdrop
- onClose={onClose}
- closeOnEscape={false}
- aria-label={t(I18nKey.ONBOARDING$TITLE)}
- >
+ // No `onClose`: the flow must only be dismissed via explicit actions
+ // (the skip button or launching), never by an errant backdrop click or
+ // Escape press β€” see https://github.com/OpenHands/agent-canvas/issues/1085.
+ <ModalBackdrop aria-label={t(I18nKey.ONBOARDING$TITLE)}>
<div className="relative flex flex-col items-center gap-4">
<section
data-testid="onboarding-modal"