Thanks to visit codestin.com
Credit goes to github.com

Skip to content

MudPopover - Expand Flip Logic to Include Anchor #11248

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

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

versile2
Copy link
Contributor

Description

Expands the current anchor flip logic to include all flip directions. If you notice, MudBlazor Docs does flip the anchor in the example, so the logic was already there. I added proper flip logic to each flip direction to swap anchor as needed and included it in the maxheight calculation.

Resolves #11177

How Has This Been Tested?

Visually, Viewer test PopoverFlipDirectionTest is good for this. Checked Docs as well.

Two notes that refer to flip logic entirely (not just this PR)

  1. FlipMargin determines a flip, that is not the same as OverflowPadding. FlipMargin by default is set to 0, so Flipping may not occur causing a scrollbar to appear because OverflowPaddingdoes occur. If any issues arise where they believe it should flip instead of creating a scrollbar they should set flipmargin to be equal to OverflowPadding in PopoverOptions. I would suggest adding a TODO to the next major release to combine the two as it would be a breaking change. OverflowPadding is Material Design standard (equates to roughly 24px).
  2. Flip-On-Open is when flip logic happens just one time and records it to the dom. If that creates a scrollbar on the popover, that scroll area will get smaller (or larger) as you scroll outside of the popover. If there's an issue the user probably wanted flip-always to have flip position recalculated every time.

Type of Changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation (fix or improvement to the website or code docs)

Checklist

  • The PR is submitted to the correct branch (dev).
  • My code follows the code style of this project.
  • I've added relevant tests.

@github-actions github-actions bot added enhancement New feature or request PR: needs review labels Apr 28, 2025
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
67.9% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@versile2
Copy link
Contributor Author

versile2 commented Apr 28, 2025

The duplication SonarCloud is complaining about is annoying but harmless here. The placePopover method is run each and every time a popover with flip is redrawn and doing it statically like it's done is far more efficient and easy to maintain if something is off down the line than replacing this with a dynamic function. In my opinion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request PR: needs review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Autocomplete popup covers the input field
1 participant