File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ ' @openproject/primer-view-components ' : patch
3+ ---
4+
5+ Fix lazy loaded action-menu positioning when opened at the bottom of the page.
Original file line number Diff line number Diff line change @@ -472,6 +472,7 @@ export class ActionMenuElement extends HTMLElement {
472472 #handleIncludeFragmentReplaced( ) {
473473 this . #firstItem?. focus ( )
474474 this . #softDisableItems( )
475+ this . overlay ?. update ( )
475476
476477 // async items have loaded, so component is ready
477478 this . setAttribute ( 'data-ready' , 'true' )
Original file line number Diff line number Diff line change @@ -310,6 +310,13 @@ def with_deferred_content(nest_in_sub_menu: false)
310310 render_with_template ( locals : { nest_in_sub_menu : nest_in_sub_menu } )
311311 end
312312
313+ # @label With deferred content near the bottom of the viewport
314+ #
315+ # @hidden
316+ def with_deferred_content_near_bottom_of_viewport
317+ render_with_template
318+ end
319+
313320 # @label With deferred preloaded content
314321 #
315322 def with_deferred_preloaded_content
Original file line number Diff line number Diff line change 1+ <%# The invoker is pinned to the bottom of the viewport so the overlay has no room to grow %>
2+ <%# downward once its deferred content loads, reproducing the scenario from DREAM-729. %>
3+ < div style ="position: fixed; bottom: 100px; right: 0; ">
4+ <%= render ( Primer ::Alpha ::ActionMenu . new ( menu_id : "deferred-bottom" , src : primer_view_components . action_menu_deferred_path ) ) do |menu | %>
5+ <% menu . with_show_button { "Menu with deferred content" } %>
6+ <% end %>
7+ </ div >
Original file line number Diff line number Diff line change @@ -890,6 +890,24 @@ def test_deferred_loading_on_keydown
890890 assert_equal page . evaluate_script ( "document.activeElement" ) . text , "Copy link"
891891 end
892892
893+ def test_deferred_loading_overlay_positioned_within_viewport
894+ visit_preview ( :with_deferred_content_near_bottom_of_viewport )
895+ click_on_invoker_button
896+
897+ # Wait for lazy content to load
898+ assert_selector "action-menu ul li" , text : "Copy link"
899+
900+ overlay_in_viewport = page . evaluate_script ( <<~JS )
901+ (function() {
902+ var el = document.querySelector('anchored-position')
903+ var rect = el.getBoundingClientRect()
904+ return rect.bottom <= (window.innerHeight || document.documentElement.clientHeight)
905+ })()
906+ JS
907+
908+ assert overlay_in_viewport , "Overlay should be positioned within the viewport after deferred content loads"
909+ end
910+
893911 def test_deferred_dialog_opens
894912 visit_preview ( :with_deferred_content )
895913
You can’t perform that action at this time.
0 commit comments