From 0b3e7afee8794f24f972ea4e70add102584e7ee7 Mon Sep 17 00:00:00 2001 From: Stefan Hausotte Date: Mon, 15 Jun 2026 14:19:17 +0200 Subject: [PATCH] fix: make issue/PR description editable in edit form (#80) The description row in DescriptionEditorSection is a Button whose label renders a MarkdownPreview when a body exists. The preview enables text selection and tappable links, which intercepted the tap inside the Button label so the editor sheet never opened. Existing issues (with a body) could therefore not have their description edited; only the empty 'None' placeholder was tappable. Disable hit testing on the preview so the tap falls through to the Button. This fixes IssueEditView, PullRequestEditView, and the create flows, which all share DescriptionEditorSection. Extend IssueMutatingUITests to edit an issue description and verify it persists, closing the coverage gap (the prior test only edited the title). --- Forji/Forji/Views/MetadataPickers.swift | 5 ++++ Forji/ForjiUITests/IssueMutatingUITests.swift | 25 +++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/Forji/Forji/Views/MetadataPickers.swift b/Forji/Forji/Views/MetadataPickers.swift index 56e1d3e..d341774 100644 --- a/Forji/Forji/Views/MetadataPickers.swift +++ b/Forji/Forji/Views/MetadataPickers.swift @@ -21,9 +21,14 @@ struct DescriptionEditorSection: View { MarkdownPreview(text: text) .font(.subheadline) .lineLimit(3) + // The preview renders selectable text and tappable links. Inside a + // Button label those intercept the tap, so the editor sheet never + // opens. Disable hit testing so the tap falls through to the Button. + .allowsHitTesting(false) } } .tint(.primary) + .accessibilityIdentifier("description-edit-button") .sheet(isPresented: $showingEditor) { DescriptionEditorSheet(text: $text, title: title, onUploadImage: onUploadImage) } diff --git a/Forji/ForjiUITests/IssueMutatingUITests.swift b/Forji/ForjiUITests/IssueMutatingUITests.swift index 84f8ecc..2585aee 100644 --- a/Forji/ForjiUITests/IssueMutatingUITests.swift +++ b/Forji/ForjiUITests/IssueMutatingUITests.swift @@ -67,11 +67,36 @@ final class IssueMutatingUITests: ForgejoUITestBase { editTitleField.tap(withNumberOfTaps: 3, numberOfTouches: 1) editTitleField.typeText("Edited issue title") + // Edit the description. Tapping the description row must open the editor + // sheet, the regression from issue #80 was that the selectable markdown + // preview swallowed the tap so the sheet never appeared. + let descriptionButton = app.buttons["description-edit-button"] + XCTAssertTrue(descriptionButton.waitForExistence(timeout: 5)) + descriptionButton.tap() + + let descriptionEditor = app.textViews["markdown-text-editor"] + XCTAssertTrue( + descriptionEditor.waitForExistence(timeout: 5), + "Tapping the description should open the editor sheet", + ) + descriptionEditor.tap() + descriptionEditor.typeText("UITESTDESC ") + app.buttons["Done"].tap() + let saveButton = app.buttons["issue-edit-save"] XCTAssertTrue(saveButton.waitForExistence(timeout: 5)) saveButton.tap() XCTAssertTrue(app.staticTexts["Edited issue title"].waitForExistence(timeout: 10)) + // The edited description must be persisted and rendered in the detail view. + let editedDescription = app.staticTexts.element( + matching: NSPredicate(format: "label CONTAINS %@", "UITESTDESC"), + ) + XCTAssertTrue( + editedDescription.waitForExistence(timeout: 10), + "Edited description should appear in the issue detail", + ) + // Close and reopen expandActionMenu() let toggleButton = app.buttons["issue-toggle-state"]