-
Notifications
You must be signed in to change notification settings - Fork 187
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
Fix runtime preventDefault / stopPropagation runtime InvalidOperationException. #1269
Conversation
- The Blazor runtime doesn't support adding attributes prior to any sort of content frames being applied. This change ensures that `ComponentAttributes` (how preventDefault / stopPropagation are represented) are handled like other HTML attributes (applied first). - Updated existing tests and their baselines. dotnet/aspnetcore#16611
@Pilchie we want to take this for 3.1-preview2. Can you please approve? Thanks! |
I can't approve for Preview 2. Please mail tactics for approval. |
@@ -2905,7 +2905,7 @@ public void EventHandler_PreventDefault_StopPropagation_Minimized() | |||
// Act | |||
var generated = CompileToCSharp(@" | |||
@using Microsoft.AspNetCore.Components.Web | |||
<input @onclick:preventDefault @onclick:stopPropagation />"); | |||
<button @onclick:preventDefault @onclick:stopPropagation>Click Me</button>"); |
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.
Is the feature not supposed to work for input type=button
?
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.
It works for input but inputs don't typically have child content ("Click Me") so I changed it to a button
Approved for 3.1 Preview 2. |
Description
Trying to use Blazor's
@onclick:preventDefault
or@onclick:stopPropagation
results in runtime invalid operation exception.Customer Impact
Customers will not be able to utilize the
preventDefault
orstopPropagation
features (even though VS will tell them they're available) because usage of them breaks their pageRegression
No because these are a new feature. The reason why this was missed is because it involved several moving parts of which required Runtime, Tooling and SDK.
Risk
Low. We're just changing the order of how things are rendered. The rendering pipeline should have been doing this from the get-go. The only reason why it wasn't was because of an oversight.
ComponentAttributes
(how preventDefault / stopPropagation are represented) are handled like other HTML attributes (applied first).Addresses dotnet/aspnetcore#16611