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

[UI][Tabs] Prevent tab focus on mousedown #4239

Merged
merged 1 commit into from
May 28, 2024

Conversation

SimoTod
Copy link
Collaborator

@SimoTod SimoTod commented May 26, 2024

Currently a tab gets the focus when you receive the mousedown event instead of the full click.
This is different from how tabs usually work everywhere else (including Tailwind Headless UI that fixed it with this PR: tailwindlabs/headlessui#1192).

Unfortunately, it's not easily testable because cypress doesn't behave that way but chrome and firefox do.

This seem to cause some interoperability issues with x-dialog too: #4230 (reply in thread) (The OP didn't provide an example though).

@calebporzio
Copy link
Collaborator

Ah this makes total sense and the mousedown prevention listener is a nice solution - I didn't know that would prevent focus but it makes sense.

I'm gonna use that in other situations too.

Thanks simone!

@calebporzio calebporzio merged commit 1927cb1 into alpinejs:main May 28, 2024
1 check passed
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

Successfully merging this pull request may close these issues.

2 participants