tailwindlabs / tailwindcss-forms

A plugin that provides a basic reset for form styles that makes form elements easy to override with utilities.
https://tailwindcss-forms.vercel.app
MIT License
4.22k stars 223 forks source link

Use focus-visible instead of focus #155

Closed DylanVann closed 7 months ago

DylanVann commented 7 months ago

This will make it so the focus styles only become active when a user is navigating using the keyboard.

vercel[bot] commented 7 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
tailwindcss-forms ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 8, 2024 9:05pm
hornta commented 7 months ago

@thecrypticace Have you had a chance to glance at this?

adamwathan commented 7 months ago

Hey! Going to say no to this one for now because a lot of people using Tailwind CSS v3 still need to support Safari 14, and :focus-visible was only added to Safari in 15.4 in March 2022.

We can change this for the v4 version of this in the future though! Will likely be a totally separate project, so going to wait until we actually dig into that before setting up a next branch or anything like that here just to merge something like this.

If it were me I would honestly just grab the output of this plugin and throw it in your CSS file and customize it. That's closer to what we're going to recommend for v4 as well, way easier to just manage this stuff in CSS than as a bunch of JavaScript for no reason:

https://gist.github.com/adamwathan/e0914c8101023124c99cf817d13e52b7