Skip to content
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

Merged
merged 1 commit into from
Oct 29, 2019

Conversation

NTaylorMullen
Copy link
Contributor

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 or stopPropagation features (even though VS will tell them they're available) because usage of them breaks their page

image

image

Regression

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.


  • 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.

Addresses dotnet/aspnetcore#16611

- 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
@mkArtakMSFT
Copy link
Member

@Pilchie we want to take this for 3.1-preview2. Can you please approve? Thanks!

@Pilchie
Copy link
Member

Pilchie commented Oct 28, 2019

I can't approve for Preview 2. Please mail tactics for approval.

@Pilchie Pilchie added this to the 3.1.0-preview2 milestone Oct 28, 2019
@@ -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>");
Copy link
Member

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 ?

Copy link
Contributor Author

@NTaylorMullen NTaylorMullen Oct 28, 2019

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

@danmoseley
Copy link
Member

Approved for 3.1 Preview 2.

@wtgodbe wtgodbe merged commit d273a0f into release/3.1-preview2 Oct 29, 2019
@wtgodbe wtgodbe deleted the nimullen/16611 branch October 29, 2019 00:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants