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

Checkbox on:click firing twice #1678

Closed
chipnetics opened this issue Mar 2, 2023 · 2 comments
Closed

Checkbox on:click firing twice #1678

chipnetics opened this issue Mar 2, 2023 · 2 comments

Comments

@chipnetics
Copy link

chipnetics commented Mar 2, 2023

Hi team,
Unsure if this is intended behaviour, but it appears the Checkbox on:click is firing twice on a single click event.

<script lang="ts">
import { Checkbox } from 'carbon-components-svelte';
 function callbackTest(e: any) {
        console.log(e)
    }
</script>

<Checkbox labelText="Test Fire" on:click={(e) => callbackTest(e)}/>

Thanks!

@metonym
Copy link
Collaborator

metonym commented Mar 2, 2023

Dupe #593

Please use on:check instead:

<Checkbox
  on:check={(e) => {
    console.log(e.detail); // boolean
  }}
/>

@metonym
Copy link
Collaborator

metonym commented Mar 2, 2023

As part of #1621, we'll standardize events and make sure this doesn't occur. For Checkbox specifically, it doesn't make sense to forward the click event to the wrapping div.

@metonym metonym closed this as completed Mar 2, 2023
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

No branches or pull requests

2 participants