Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attribute splatting for HxContextMenu dropdown trigger element #844

Merged
merged 2 commits into from
Oct 1, 2024

Conversation

crdo
Copy link
Member

@crdo crdo commented Jun 27, 2024

Adressing Issue #118 [HxGrid] Context menu causes scrollbar

@crdo crdo linked an issue Jun 27, 2024 that may be closed by this pull request
Copy link
Member

@hakenr hakenr left a comment

Choose a reason for hiding this comment

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

Although I understand the current need (#118), I'm not satisfied with the selective decision we are making here when splatting the additional attributes to some inner .hx-context-menu-btn element (div.hx-context-menu > div.dropdown > div.hx-context-menu-btn).

In the case of HxInputBase components, the additional attributes are splatted to the input (to maintain the InputBase approach). All the other components (hopefully) are splatting the additional attributes to the dominant element (the outermost one).

We should find another way to achieve the goal. Is there any relevant scenario where the data-bs-popper-config='{"strategy":"fixed"}' should not be used? Can we set this config always?

@crdo
Copy link
Member Author

crdo commented Jul 1, 2024

I don't think it is a good idea to make "strategy":"fixed" default. If the .dropdown-menu element is set as position: fixed; its position is calculated and updated when you scroll the window. While with position: absolute;, it is calculated on the first render and thats it.

@crdo
Copy link
Member Author

crdo commented Jul 1, 2024

On the other hand - if you start scrolling while the HxContextMenu is open, it disappears as you no longer hover the row.

@hakenr
Copy link
Member

hakenr commented Jul 1, 2024

New PopperStrategy="[Absolute|Fixed]" parameter?

@crdo
Copy link
Member Author

crdo commented Jul 15, 2024

Either PopperStrategy or PositionStrategy works for me.

@hakenr
Copy link
Member

hakenr commented Oct 1, 2024

Added new PopperStrategy parameter to HxContextMenu, which allows to fix the issue:

  <HxContextMenu PopperStrategy="PopperStrategy.Fixed">

If you feel this should be configurable as application-wide default with HxContextMenu.Defaults.PopperStrategy, please create a separate issue.

@hakenr hakenr merged commit b1221a8 into master Oct 1, 2024
1 check passed
@hakenr hakenr deleted the feature/HxContextMenuAttributeSplatting branch October 1, 2024 23:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[HxGrid] Context menu causes scrollbar
2 participants