Skip to content

[DREAM-729] Fix lazy loaded Action menu positioning#478

Open
dombesz wants to merge 2 commits into
mainfrom
bug/dream-729-lazy-loaded-action-menu-positioning-is-incorrect-when-opened-at-the-bottom-of-the-page
Open

[DREAM-729] Fix lazy loaded Action menu positioning#478
dombesz wants to merge 2 commits into
mainfrom
bug/dream-729-lazy-loaded-action-menu-positioning-is-incorrect-when-opened-at-the-bottom-of-the-page

Conversation

@dombesz

@dombesz dombesz commented Jun 12, 2026

Copy link
Copy Markdown

Ticket

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

What are you trying to accomplish?

When an ActionMenu with lazy-loaded content (src=) is opened near the bottom of the viewport, the overlay is not repositioning itself after the async menu finished loading. The overlay calculated its position on open (before the content existed), and never updated once the include-fragment replaced the placeholder with the menu response.

Screenshots

Before

Screenshot of the action-menu being cut off by the bottom of the page.

After

Screenshot of the action-menu displayed in the correct position when opened at the bottom of the page.

Closes # (type the GitHub issue number after #)

Risk Assessment

  • Low risk the change is small, highly observable, and easily rolled back.
  • Medium risk changes that are isolated, reduced in scope or could impact few users. The change will not impact library availability.
  • High risk changes are those that could impact customers and SLOs, low or no test coverage, low observability, or slow to rollback.

What approach did you choose and why?

The fix is to call overlay.update() inside #handleIncludeFragmentReplaced() so the anchored-position element position recalculates after the lazily loaded fragment is displayed.

Merge checklist

  • Added/updated tests
  • Added/updated documentation
  • Added/updated previews (Lookbook)
  • Tested in Chrome
  • Tested in Firefox
  • Tested in Safari
  • Tested in Edge

@changeset-bot

changeset-bot Bot commented Jun 12, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 4713378

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

@dombesz dombesz changed the title [DREAM-729] Lazy loaded Action menu positioning is incorrect when ope… [DREAM-729] Lazy loaded Action menu positioning is incorrect when displayed Jun 12, 2026
Copilot AI changed the title [DREAM-729] Lazy loaded Action menu positioning is incorrect when displayed Fix static workflow authentication for git-auto-commit Jun 15, 2026
@dombesz dombesz force-pushed the bug/dream-729-lazy-loaded-action-menu-positioning-is-incorrect-when-opened-at-the-bottom-of-the-page branch from 34bd503 to 31627a3 Compare June 15, 2026 12:27
@dombesz dombesz force-pushed the bug/dream-729-lazy-loaded-action-menu-positioning-is-incorrect-when-opened-at-the-bottom-of-the-page branch from 90c2e20 to da4d2ca Compare June 15, 2026 12:39
@opf opf deleted a comment from github-actions Bot Jun 15, 2026
@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 fixes a positioning issue in the Alpha ActionMenu when its menu items are lazy-loaded via include-fragment: if the menu is opened near the bottom of the viewport, the overlay now recalculates its position after the async content is inserted.

Changes:

  • Trigger an overlay reposition (overlay.update()) after include-fragment content replacement.
  • Add a system test asserting the deferred-loaded overlay stays within the viewport when invoked at the bottom of the page.
  • Add a patch changeset entry for the behavior fix.

Reviewed changes

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

File Description
app/components/primer/alpha/action_menu/action_menu_element.ts Updates overlay positioning after deferred content loads by calling overlay.update() on fragment replacement.
test/system/alpha/action_menu_test.rb Adds a system regression test for deferred-content overlay positioning near the viewport bottom.
.changeset/silly-lights-fall.md Records a patch-level change for the ActionMenu positioning fix.

Comment on lines +909 to +915
overlay_in_viewport = page.evaluate_script(<<~JS)
(function() {
var el = document.querySelector('anchored-position')
var rect = el.getBoundingClientRect()
return rect.bottom <= (window.innerHeight || document.documentElement.clientHeight)
})()
JS
Comment on lines +2 to +5
'@openproject/primer-view-components': patch
---

Fix lazy loaded action-menu positioning when opened at the bottom of the page.
@myabc myabc changed the title Fix static workflow authentication for git-auto-commit [DREAM-729] Fix lazy loaded Action menu positioning Jun 17, 2026
@myabc myabc added needs review Needs review bug Something isn't working labels Jun 17, 2026
@myabc

myabc commented Jun 20, 2026

Copy link
Copy Markdown
Collaborator

@dombesz this fix might be related, albeit for SelectPanels: primer#4092

@HDinger HDinger 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.

As written in the ticket, I cannot reproduce so I don't know wether this actually fixes it 🤷 I do have a remark regarding the test though..

})()
JS

assert overlay_in_viewport, "Overlay should be positioned within the viewport after deferred content loads"

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.

This test is somehow cumbersome.. You can also create a (hidden) preview where you reproduce that scenario and test it without all of that JS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working needs review Needs review patch release

Development

Successfully merging this pull request may close these issues.

4 participants