Skip to content

Commit

Permalink
Make the default behavior clear on forms with attached event handlers.
Browse files Browse the repository at this point in the history
  • Loading branch information
vgobbo committed Aug 13, 2023
1 parent 259ba28 commit 8106538
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/guide/src/en/interactivity/event_handlers.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Any event handlers will still be called.

> Normally, in React or JavaScript, you'd call "preventDefault" on the event in the callback. Dioxus does _not_ currently support this behavior. Note: this means you cannot conditionally prevent default behavior based on the data in the event.
> Note for web developers: on Javascript the default behavior is to **submit the form**, while on Dioxus the default behavior is **to not submit the form**. Consequently, specifying `prevent_default: "onsubmit"` will cause the form to be submitted.
> Note about forms: if an event handler is attached to the `onsubmit` event of a form, default behavior is to **not submit it**, meaning having `prevent_default: "onsubmit"` will submit it in this case.
## Handler Props

Expand Down
2 changes: 1 addition & 1 deletion docs/guide/src/pt-br/interactivity/event_handlers.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@ Então, você pode usá-lo como qualquer outro manipulador:
>
> Você também pode colocar dados personalizados no evento, em vez de, por exemplo, `MouseData`
> Nota para desenvolvedores web: em Javascript o comportamento padrão é o de **submeter o formulário**, porém no Dioxus o comportamento padrão é de **não submeter o formulário**. Consequentemente, especificar `prevent_default: "onsubmit"` fará com que o formulário seja submetido.
> Nota sobre formulários: se um manipulador de evento está anexado ao evento `onsubmit` em um formulário, o comportamento padrão é de **não submetê-lo**. Portanto, especificar `prevent_default: "onsubmit"` irá submetê-lo.

0 comments on commit 8106538

Please sign in to comment.