havit / Havit.Blazor

Free Bootstrap 5 components for ASP.NET Blazor + optional enterprise-level stack for Blazor development (gRPC code-first, layered architecture, localization, auth, ...)
https://havit.blazor.eu
MIT License
516 stars 68 forks source link

[HxContextMenuGridColumn] Using HxContextMenu in HxGrid causes extra scrollbar to apear when dropdow is larger then the grid #898

Open TPIvan opened 1 month ago

TPIvan commented 1 month ago

Using HxContextMenu within HxGrid in responsive mode causes an extra vertical scrollbar to appear when the context menu dropdown is higher than the grid itself.

Observed behavior: The grid displays an unnecessary vertical scrollbar when the context menu dropdown overflows the grid's height. image Expected behavior (achieved with<style type="text/css">.table-responsive {overflow-x:initial;} </style>): The grid should not display an additional scrollbar, allowing the context menu dropdown to expand freely without affecting the grid's vertical scrolling. image Steps to Reproduce:

  1. Follow the example in the Havit.Blazor documentation for HxGrid with context menus (https://havit.blazor.eu/components/HxGrid#context-menu).
  2. Set the PageSize property of the HxGridto 1.

    <HxGrid @ref="gridComponent" TItem="EmployeeDto" DataProvider="GetGridData" PageSize="1" Responsive="true">

    In my real situation, I have two rows in the grid and three rows in the context menu.

The problem is the same as described in issue #449, and the solution should follow the approach outlined in https://github.com/havit/Havit.Blazor/issues/450#issuecomment-2049223815. The problem is that it appears that there is currently no way to apply AdditionalAttributes to the dropdown toggler. I believe the correct solution would be for

    data-bs-popper-config='{"strategy":"fixed"}' 

to be added by HxGrid when Responsive="true".

crdo commented 1 month ago

This is something that should have been addressed in the latest release by adding PopperStrategy parameter to the HxContextMenu. Are you on the latest version?

crdo commented 1 month ago

... we decided not to use attribute splatting for performance reasons as unlike the dropdowns or form controls, the context menu is usually rendered in a loop.

TPIvan commented 1 month ago

I have version 4.6.15 (installed yesterday). Applying the strategy through the attribute feels more like a workaround than a proper solution to me.

crdo commented 1 month ago

And what would be a proper solution to you?

crdo commented 1 month ago

Should you be interested, the discussion on this topic is here https://github.com/havit/Havit.Blazor/pull/844

TPIvan commented 1 month ago

I reviewed #844. In my opinion, the strategy should be controlled by the Responsive property without requiring any additional attributes, as "absolute" only works well in ideal conditions.

TPIvan commented 1 month ago

I currently need to apply strategy:fixed even if the dropdown is not in grid because of issues with scrollbars and partial visibility, but I have a complex form with independently scrollable sections.

TPIvan commented 1 month ago

I can confirm that the issue can be resolved using the PopperStrategy attribute in the latest version. However, I still believe that this should be addressed within the grid component itself. Please feel free to close this issue if you disagree.

hakenr commented 1 month ago

@crdo Can we add the PopperStrategy to our demo and/or related instructions? Or is this still an "it depends" scenario, where you'd only want this strategy for certain HxGrid context menus?

hakenr commented 1 month ago

Based on the internal discussion: If feasible (without impacting performance), we should set the new PopperStrategy as the default for context menus within HxGrid.