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

bug: ion-checkbox don't let interact with label #29304

Closed
3 tasks done
JEricaM opened this issue Apr 9, 2024 · 3 comments
Closed
3 tasks done

bug: ion-checkbox don't let interact with label #29304

JEricaM opened this issue Apr 9, 2024 · 3 comments
Assignees
Labels

Comments

@JEricaM
Copy link

JEricaM commented Apr 9, 2024

Prerequisites

Ionic Framework Version

v7.x

Current Behavior

Adding a link inside the checkbox label should let the user open the link.

Expected Behavior

A link/click inside a label in checkbox should work correctly.

Steps to Reproduce

Add a ion.checkbox like that

<ion-checkbox
                                        value={value}
                                        name='name'
                                        onIonChange={(e) => this.handleChangeCheck(e)}
                                        label-placement="end">
                                        <div class="ion-text-wrap">My text <a href="https://google.it"> click here</a></div>
                                    </ion-checkbox>

If I click on the link part of the label the href don't triggers, instead only works onIonChange.

Code Reproduction URL

https://d6xspp.stackblitz.io

Ionic Info

Ionic:

Ionic CLI : 7.1.1

Utility:

cordova-res : not installed globally
native-run : not installed globally

System:

NodeJS : v18.15.0
npm : 9.5.0
OS : macOS Unknown

Additional Information

No response

@liamdebeasi
Copy link
Contributor

Thanks for the report. This can be achieved by calling stopPropagation when the link is clicked. We've had this question asked a few times before, so I decided to add an example to our documentation on how to do this.

I've opened ionic-team/ionic-docs#3584 to add this demo. Here is a preview of the docs: https://ionic-docs-git-checkbox-link-ionic1.vercel.app/docs/api/checkbox#links-inside-of-labels

I am going to close this since this is already achievable in Ionic, but let me know if you have questions.

@liamdebeasi liamdebeasi closed this as not planned Won't fix, can't repro, duplicate, stale Apr 9, 2024
@JEricaM
Copy link
Author

JEricaM commented Apr 9, 2024

thank you so much, the example in the doc it's perfect!

Copy link

ionitron-bot bot commented May 9, 2024

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators May 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants