fix: make issue/PR description editable in edit form (#80) (#81)

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).

Closes #80

Reviewed-on: https://codeberg.org/secana/Forji/pulls/81
This commit is contained in:
Stefan Hausotte 2026-06-15 14:20:24 +02:00 committed by secana
parent 69f7923a52
commit 64145f50cc
2 changed files with 30 additions and 0 deletions

View file

@ -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)
}

View file

@ -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"]