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] - Switch not toggling when text is highlighted #3586

Closed
DawidAbram opened this issue Jul 31, 2024 · 3 comments
Closed

[BUG] - Switch not toggling when text is highlighted #3586

DawidAbram opened this issue Jul 31, 2024 · 3 comments

Comments

@DawidAbram
Copy link

NextUI Version

2.4.6

Describe the bug

The switch is not toggleable when some text on the page is highlighted/selected. Can be viewed even on the documentation page for the switch component.

Your Example Website or App

https://nextui.org/docs/components/switch

Steps to Reproduce the Bug or Issue

  1. Select some text on the page with the switch
  2. Try to toggle the switch

Screenshot 2024-07-31 at 18 35 00

It will only work if you double click, and not always.

Expected behavior

As a user, I would expect the focus to change to the switch and it to toggle without a problem.

Screenshots or Videos

No response

Operating System Version

macOS

Browser

Chrome

Copy link

linear bot commented Jul 31, 2024

@DawidAbram
Copy link
Author

For anyone that has this issue, a temporary solution I applied is to create a wrapper component which has an onClick that will remove the text selection:

onClick={(e) => { window.getSelection()?.removeAllRanges(); props.onClick?.(e); }}

@awesome-pro
Copy link
Contributor

awesome-pro commented Jul 31, 2024

@DawidAbram this issue will be resolved by #3552

Kindly close the issue

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