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

Skip to content

Conversation

meenzen
Copy link
Contributor

@meenzen meenzen commented Nov 28, 2024

Description

see #10122 (comment)

Before:

image

After:

image

New docs section:

image

How Has This Been Tested?

unit, visually

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 Request for adding a new feature or enhancing existing functionality (not fixing a defect) PR: needs review labels Nov 28, 2024
@meenzen meenzen marked this pull request as draft November 28, 2024 17:46
@meenzen
Copy link
Contributor Author

meenzen commented Nov 28, 2024

@ScarletKuro do you think this is the right approach? Also I'm not sure about the parameter name Hidden, any better ideas?

If you think this is OK I can add tests and docs tomorrow.

Copy link

codecov bot commented Nov 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.43%. Comparing base (43fbb95) to head (ca14c64).
Report is 8 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev   #10349      +/-   ##
==========================================
- Coverage   91.48%   91.43%   -0.06%     
==========================================
  Files         415      417       +2     
  Lines       13053    13222     +169     
  Branches     2473     2538      +65     
==========================================
+ Hits        11942    12089     +147     
- Misses        548      554       +6     
- Partials      563      579      +16     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ScarletKuro ScarletKuro requested review from henon, danielchalmers and ScarletKuro and removed request for henon November 28, 2024 18:34
@versile2
Copy link
Contributor

Had to get caught up, question- Shouldn't that button always be hidden or visibility collapse or something when not in a popover? I think could probably solve it all with just a css class when laid out in that manner under a popover to not show it and disable it but the popover version would work fine

@ScarletKuro
Copy link
Member

@versile2 @henon @danielchalmers
What do you guys think? I think this solution is good for edge cases. Ideally, it would be great if the DataGrid natively supported context menus on rows and allowed customization. Then MudMenu near the DataGrid with PositionAtCursor="true" wouldn't be necessary. However, since there isn't such support, I think the proposed solution is the only workaround.

Copy link
Member

@danielchalmers danielchalmers left a comment

Choose a reason for hiding this comment

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

Might be a stupid question but why can't we add the mud-menu-hidden class if the activator content is null? Why do we need a second property?

@henon
Copy link
Collaborator

henon commented Nov 28, 2024

I guess @danielchalmers has a point. Should we decide to keep the parameter though I'd like it to be named ShowButton instead.

@meenzen
Copy link
Contributor Author

meenzen commented Nov 28, 2024

Might be a stupid question but why can't we add the mud-menu-hidden class if the activator content is null? Why do we need a second property?

When the activator content is null a default button is shown. That's the main use of MudMenu.

@danielchalmers
Copy link
Member

danielchalmers commented Nov 28, 2024

Might be a stupid question but why can't we add the mud-menu-hidden class if the activator content is null? Why do we need a second property?

When the activator content is null a default button is shown. That's the main use of MudMenu.

Right, no activator content or label = hidden?

<MudMenu>
    <MudMenuItem>Enlist</MudMenuItem>
    <MudMenuItem>Barracks</MudMenuItem>
    <MudMenuItem>Armory</MudMenuItem>
</MudMenu>

Do people use the empty button that's shown in your Before example?

@meenzen
Copy link
Contributor Author

meenzen commented Nov 29, 2024

Right, no activator content or label = hidden?

I like this idea.

Do people use the empty button that's shown in your Before example?

I hope not. I think this behavior qualifies as unintended / buggy.

@henon
Copy link
Collaborator

henon commented Nov 29, 2024

Right, no activator content or label = hidden?

I like this idea.

We can do this but we should explicitly document it with an example in the docs.

Comment on lines -410 to -412
[TestCase(null, "Close menu", "Close menu")]
[TestCase("x", "Close menu", "Close menu")]
[TestCase(null, null, null, Description = "Ensures aria-label is not present instead of empty string")]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I had to remove these test cases because the button isn't rendered anymore when the label is null.

@meenzen meenzen changed the title Draft: MudMenu: Allow hiding the activator for programmatic use MudMenu: Allow hiding the activator for programmatic use Nov 29, 2024
@meenzen meenzen marked this pull request as ready for review November 29, 2024 13:02
@henon henon changed the title MudMenu: Allow hiding the activator for programmatic use MudMenu: Hide Button when Label, Icon and Content are unset Nov 29, 2024
Copy link
Member

@danielchalmers danielchalmers left a comment

Choose a reason for hiding this comment

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

Cool!

@henon henon merged commit 305a82e into MudBlazor:dev Nov 30, 2024
4 checks passed
@henon
Copy link
Collaborator

henon commented Nov 30, 2024

Thanks @meenzen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Request for adding a new feature or enhancing existing functionality (not fixing a defect)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants