Calcite-components: Bug: calcite-button does not call on:submit event setup with Svelte

Created on 25 Feb 2021  路  2Comments  路  Source: Esri/calcite-components

Summary

In Svelte, events are setup using on:... syntax. So the correct way to setup a form would be:

<form on:submit={onSubmitHandler}>
    <!-- inputs, etc -->
    <calcite-button type="submit">Submit</calcite-button>
</form>

Because the "type" of the button is "submit", per #193 / #197, it should call our form on:submit handler.

Actual Behavior

When using calcite-button (with type="submit"), the svelte on:submit handler is not called.

Expected Behavior

When using calcite-button (with type="submit"), the svelte on:submit handler should be called.

Reproduction Steps

  1. git clone https://github.com/gavinr/calcite-components-svelte-form-submit-issue
  2. cd calcite-components-svelte-form-submit-issue
  3. npm install
  4. npm run dev

See the live site here: https://gavinr.github.io/calcite-components-svelte-form-submit-issue/

Additional Info

This is similar to #381 (but for the Svelte framework instead of React)

0 - new bug

Most helpful comment

All 2 comments

This might just be because the button is in shadow dom.

Was this page helpful?
0 / 5 - 0 ratings