-
Notifications
You must be signed in to change notification settings - Fork 12
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
Element queries! #7
Comments
Rad!! I'll see what it takes to seamlessly integrate this: |
Looks like there's also this: |
@MichaelArestad It looks like these libraries work quite differently (the 2 links I shared above). Is there a particular solution you had in mind? Also! Do you know how it's currently being used in Gutenberg? (I think it's there... At least, I remember reading about it) |
I believe @jasmussen did some work with element queries in Gutenberg late last year: |
The Placeholder component in the block editor uses a JS resize observer to provide element queries. It's working well, and provides the feature in a compatible way today, which might work well here. The polyfill I tried did not play well with react, as it relied on setting classnames that were quickly sanitized away by the system. |
Oooo... I see. It was a ad-hoc implementation, rather than something with CSS compiling. It would be nice to have a... it just works. Kind of workflow :) https://github.com/marcj/css-element-queries Seems to be the most promising solution. Ultimately, it works with (and uses) valid CSS: .widget-name[min-width~="400px"] h2 {
font-size: 18px;
} It's just the DOM target binding bit that's the tricky part. 🤔 |
Note to self: (Apologies in advance, the following may not make sense...)
|
I would love to see some element queries to make the interface components even more flexible. For example, if the parent container is less than 200px wide, then make the grid one column instead of two.
The text was updated successfully, but these errors were encountered: