Comments (8)
We just make OnClick obsolete with a message to use VisibleChanged instead. After it has been obsoleted for a time we can remove it in a future major version.
from mudblazor.
I'm planning to replace all other usages of OnClick
with the VisibleChanged
event like I did in #8914 in order to avoid subtle bugs. How do we stop people from falling into this same anti-pattern without removing OnClick
entirely? @henon @ScarletKuro
from mudblazor.
/// <summary>
/// Triggers an event callback when the overlay is clicked.
/// </summary>
[Parameter]
[Obsolete("Use VisibleChanged with AutoClose to handle the overlay disappearing in a universal way.")]
public EventCallback<MouseEventArgs> OnClick { get; set; }
Can we make AutoClose true by default? It seems like that's the only way it's actually used in the whole library so it would make sense if we made that switch while moving away from OnClick
. The pattern is always "OnClick = make visible false".
from mudblazor.
OK, we can change AutoClose
to true by default. Maybe we should think if obsoleting OnClick is even necessary. What if someone wants to use AutoClose="false" and doesn't want to close on click but still get the click event to do something, i.e. show a message or whatever? Once we remove it that wouldn't be possible any longer.
As for prevending people to use OnClick
instead of AutoClose
we can also just show a warning box in the docs.
from mudblazor.
Or maybe we add an OnClosing
eventcallback with class CloseEventArgs
which contain a writable property bool Cancel
which the user can use to prevent or allow the overlay from closing based on their business logic? In the overlay we await the OnClosing
eventcallback and based on the value of Cancel
update Visible
accordingly?
WPF has such logic, would this be ok for Blazor as well @ScarletKuro ?
from mudblazor.
ping @ScarletKuro
from mudblazor.
I'm going to put this on hold due to the potential for issues to pop up and some components (MudDrawer) really need further refactoring which will take more time.
from mudblazor.
WPF has such logic, would this be ok for Blazor as well @ScarletKuro ?
Yeah
from mudblazor.
Related Issues (20)
- MudRating icons are gray HOT 2
- Rework Breadcrumbs
- Loading animation on buttons HOT 4
- DateRangePicker returns empty range
- MudFileUpload triggered twice HOT 3
- MudMenu open on MudDataGrid row context click
- Dial/Knob/Angle and 3DOF orientation components?
- Issues filtering the same column at MudDataGrid HOT 3
- Cursor Jumping issue in Blazor server app. HOT 3
- MudFileUpload Drag and drop same document multiple times fails HOT 3
- DataGrid column resizing (container) with sticky columns scroll breaks HOT 1
- Incorrect Position Calculation for MudMenu Component on Small Screens HOT 2
- MudMenu error with logout HOT 2
- MudTextField with numeric input mode and type not binding properly when an e is in the text of the field
- DatePicker not showing text after keyboard input on Blazor server app HOT 3
- Consistent usage of `.` vs `_` in resx.
- Optimize the Distance Between Icon and Text in MenuItem Component
- MudTextField with mask not set on browser autofill
- cannot set initial value of MudNumericField HOT 1
- AggregateDefinition<T> should have NumberFormat Property HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mudblazor.