Skip to content

[DREAM-752] Links in collapsible headers collapse/expand before redirecting - #501

Merged
HDinger merged 4 commits into
mainfrom
bug/dream-752-links-in-collapsible-headers-collapse-expand-before-redirecting
Jul 24, 2026
Merged

[DREAM-752] Links in collapsible headers collapse/expand before redirecting#501
HDinger merged 4 commits into
mainfrom
bug/dream-752-links-in-collapsible-headers-collapse-expand-before-redirecting

Conversation

@HDinger

@HDinger HDinger commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

What are you trying to accomplish?

Avoid that clicks on links or button in a collapsible section trigger the collapse mechanism

List the issues that this change affects.

https://community.openproject.org/wp/DREAM-752

Risk Assessment

  • Low risk the change is small, highly observable, and easily rolled back.

@HDinger
HDinger force-pushed the bug/dream-752-links-in-collapsible-headers-collapse-expand-before-redirecting branch from 69b83fe to a99c59a Compare July 20, 2026 11:35
@opf opf deleted a comment from changeset-bot Bot Jul 20, 2026
@HDinger
HDinger force-pushed the bug/dream-752-links-in-collapsible-headers-collapse-expand-before-redirecting branch from a99c59a to 9373085 Compare July 20, 2026 11:40
@changeset-bot

changeset-bot Bot commented Jul 20, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 490a39e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@openproject/primer-view-components Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

Copy link
Copy Markdown

⚠️ Visual or ARIA snapshot differences found

Our visual and ARIA snapshot tests found UI differences. Please review the differences by viewing the files changed tab to ensure that the changes were intentional.

Review differences

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses DREAM-752 by preventing collapsible headers (OpenProject CollapsibleSection/CollapsibleElement) from toggling collapse/expand when users interact with nested links/buttons, so navigation/actions aren’t disrupted by the collapse behavior.

Changes:

  • Update the shared CollapsibleElement#toggle behavior to ignore clicks originating from links/buttons.
  • Add a hidden Lookbook preview demonstrating a link inside the collapsible title.
  • Add a system test ensuring clicking a title link does not collapse the section, plus a changeset entry.

Reviewed changes

Copilot reviewed 5 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
app/components/primer/open_project/collapsible.ts Adds event-target filtering to prevent nested interactive elements from triggering collapse.
test/system/open_project/collapsible_section_test.rb Adds a regression test for clicking a link inside the collapsible title area.
previews/primer/open_project/collapsible_section_preview.rb Registers a hidden preview scenario for a link-in-title case.
previews/primer/open_project/collapsible_section_preview/with_link_in_title.html.erb Implements the preview template rendering a link in the title slot.
.changeset/orange-insects-rest.md Documents the patch-level behavioral change for release notes.

Comment thread app/components/primer/open_project/collapsible.ts
Comment thread .changeset/orange-insects-rest.md Outdated
@myabc
myabc self-requested a review July 21, 2026 20:31

@myabc myabc left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately I haven't been able to test manually. There is an issue with my local dev environment + transpiling TypeScript: it might be that rebasing resolves things.

That said, the Copilot comments look correct to me. As far as I can tell, the current implementation still toggles the section when a link is followed using the keyboard.

I would still prefer an alternative, accessible approach that avoids nested interactive elements entirely.

Regarding the downstream use in BorderBoxListComponent:

  • I'd prefer to make CollapsibleHeader private to core, or inline it there. Its only other consumer is in meetings, which could ideally be migrated to BorderBoxListComponent over time.
  • I don't think CollapsibleSection needs to support links, so I'm not sure it's useful to add tests for that behaviour at the component level.

PR #511 should help quieten the snapshot noise.

@HDinger
HDinger force-pushed the bug/dream-752-links-in-collapsible-headers-collapse-expand-before-redirecting branch 5 times, most recently from e7d2ba2 to e920b7e Compare July 22, 2026 08:43
@HDinger
HDinger requested a review from myabc July 22, 2026 08:58

@myabc myabc left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect we might need to revisit the increased spacing once we have integrated this downstream. For now though, this looks good! 👍🏻

@myabc

myabc commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

@HDinger this could do with a rebase prior to merging!

@HDinger
HDinger force-pushed the bug/dream-752-links-in-collapsible-headers-collapse-expand-before-redirecting branch from ea42c11 to f97584e Compare July 24, 2026 06:17
@HDinger
HDinger merged commit 252586d into main Jul 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

4 participants