Comments (6)
okay I got it sorted. The issue was an over site on my part as a result of missing an Astro client directive . I was doing the initial data-focus tests with a button component which as it turns out, in the location I was testing, was missing the proper client directive. 😅 This resulted in the data-focus-visible attributes actually not being set in the DOM.
Everything is working smoothly now. I am in the process of refactoring and migrating from the tailwind modifiers to the provided Aria data states!
from baselayer.
btw if you want to apply styles to the children based on the data attributes, you can do it with group
class from tailwind.
The way I currently do in my components is that I add a group
class to the root of the component where the data-attributes are going to be set, and then on the children elements I use group-data-[state=open]:<your-class>
to apply styles based on data attribute.
P.S. btw I love your vscode extension approach. It's pretty neat.
from baselayer.
Thanks for the kind words and all the thoughtful feedback!
The focus/hover styling is something that has been on my to do list to improve. While building I was running into some issues with the data-focus-visible/data-hover and Tailwind.
Take the Button component for example. I could not get [&[data-focus-visible]]:ring-2 to work. It’s odd because other data attributes work fine this way such as things like [&[data-outside-month]]:hidden in the Calendar.
I suppose I could pass isFocusVisible as a variant prop, then make a “focused” variant. However I was trying to avoid that for brevity, if possible.
Any reason why the css selector version is not working for things like data-focus-visible or data-hovered, but is working for things like data-outside-month?
from baselayer.
hmm not sure. I usually use the data-[focus-visible]:
syntax, but I would have thought the one you showed here would work too? I do see the data-focus-visible
attribute getting applied in the DOM so not sure why tailwind wouldn't pick it up. I definitely have a bunch of examples where it works. Maybe try the data attribute syntax instead of fully custom arbitrary selectors and see if that helps?
from baselayer.
going to close this. Just merged a ton of upgrades. I changed all the focus states to data-focus-visible or data-focused, as well as upgraded all the tailwind modifiers (hover, active) to the relative Aria data-states.
@devongovett Thanks again for your attention on this, everything should be much improved now!
from baselayer.
Nice looks like it is working well!
from baselayer.
Related Issues (1)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from baselayer.