Prevent default

Currently we don't call preventDefault by default on DOM events in most cases. The one exception is for form submit events: in that case, if you have a C# onsubmit handler, you almost certainly don't really want to perform a server-side post, especially given that it would occur before an async event handler.

Later, it's likely that we'll add a syntax for controlling whether any given event handler triggers a synchronous preventDefault before the event handler runs.

Form with onsubmit handler

{ })>

Form without onsubmit handler

@if (didHandleEvent) {

Event was handled

} @functions { bool didHandleEvent; async Task HandleClick() { await Task.Delay(250); // To give time for default action if it's going to occur didHandleEvent = true; } }