-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
MudListItem and MudMenuItem: Render as anchor with"Href" property (#1717) #8649
MudListItem and MudMenuItem: Render as anchor with"Href" property (#1717) #8649
Conversation
…ef" prop is given
The breaking change is in my opinion minor as it concerns |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev #8649 +/- ##
==========================================
+ Coverage 89.82% 90.20% +0.37%
==========================================
Files 412 423 +11
Lines 11878 12274 +396
Branches 2364 2407 +43
==========================================
+ Hits 10670 11072 +402
+ Misses 681 668 -13
- Partials 527 534 +7 ☔ View full report in Codecov by Sentry. |
Another thing that I would like to discuss here. What is the intended behaviour when both Href and OnClick handlers are present. I think the behaviour should be consistent across all components. From my understanding, if Href is set the OnClick should not be called. But this decision imposes some troubles. It is for example not easily possible to add an MenuClose handler to inner MudListItem. For my expectation it would be best to always call the OnClick handler. That might close a menu and Browser client can do a navigation (even to a new tab) -- then the close menu is desired. I think it is quite important to have a discussion on this intended behaviour, to get a consistent design! My Pull-Request tried to solve the problem of #1717, but it seems there are more thoughts required! |
Sorry, I think my PR #8634 added conflicts to your PR, since I did method renaming, so was the tests affected too. |
…rameter Previously the ClickPropagation parameter had MudElement internal logic. E.g. the parameter was only applied when the HtmlTag was an "button". This logic has been moved to MudBaseButton.
I've merged with |
@danielchalmers I followed your recommendations and left the |
|
||
[Parameter] | ||
[Category(CategoryTypes.Button.Behavior)] | ||
public bool PreventDefault { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this only applies to onclick
the name should probably reflect that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this only applies to onclick the name should probably reflect that
Yes it only applies to onclick, but other components use the same name too. In my original pull request I named it different StopOnClickPropagation
someone argued, that I should keep the name.
We could name ist OnClickPropagion
but the I liked my original proposal more, because it just uses the same names as dot net uses.
Honestly I'm very uncertain here.
I agree that calling the |
@henon Isn't it a problem that several other controls do it the other way? |
Yeah, that is a problem. I don't understand why it is like that. It is always a bad idea to try to "save the user from its own supposed stupidity". Most of the times you just hinder advanced use-cases for nothing. |
@belucha Please resolve conflicts. What's the status? We should get this done for v7 |
…m-ShouldRenderAsAnchor # Conflicts: # src/MudBlazor.UnitTests/Components/MenuTests.cs # src/MudBlazor/Base/MudBaseButton.cs # src/MudBlazor/Components/List/MudListItem.razor # src/MudBlazor/Components/List/MudListItem.razor.cs
@henon I've just resolved all conflicts. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just rename the private properties then it should be ready for merging.
Thanks! |
@henon Thanks to you and the others for the great work on this lib! |
Added to v7.0.0 Migration Guide #8447 |
@henon public bool ApplyClickPropagation => HtmlTag != "button" || ClickPropagation; this should be private and matching to your convention: private bool GetClickPropagation() => HtmlTag != "button" || ClickPropagation; Do you wan't me to open a new pull request, or do you change that yourself? Sorry for this mistake. |
Don't worry, I am fixing it myself. |
Description
fixes #1717
MudElement
is used to render a MudListItem either using adiv
or ana
element to render the item.This way a list and or menu item with an Href can be opened in a new browser tab using the right click menu.
MudElement
had to be modified the ClickPropagation property was depending on the HtmlTag value, this logic was moved tothe MudBaseButton.
How Has This Been Tested?
Types of changes
Checklist
dev
).