Replies: 8 comments 12 replies
-
Hi, thanks for the nice words, we are happy you like what we built. We did review the CSS anchor spec internally and identified some aspects that would make it less than ideal to replace parts, or the entirety, of what Floating UI exposes today. It's been a few months since I reviewed it the last time so maybe it evolved to address them, but some thoughts in random order are:
We are happy to talk more about it if you'd like to, even directly on Meet. |
Beta Was this translation helpful? Give feedback.
-
Hey! 👋 Thank you so much for the valuable insights and feedback on the current state of the API. It's really great feedback 🙏 Thank you also for the offer to meet with us! |
Beta Was this translation helpful? Give feedback.
-
@jh3y I have some questions about the current state of the CSS anchoring API. Ideally, the positioning part of the library could leverage most of the native CSS API (with fallback for older browsers), and sort of pivot to being more of a wrapper around the positioning logic? How much of the current middleware functionality can be replicated with only CSS?
Others:
|
Beta Was this translation helpful? Give feedback.
-
Sorry for the delay in this comment.
Not currently. This was discussed in w3c/csswg-drafts#7757, but it's a chunk of additional complexity to figure out exactly how it would work and how to specify it. (Flipping, on the other hand, is pretty trivial.) If this is important, opening an issue in CSSWG with details on how y'all do it would be great!
Currently it's not possible to know what position set you're in, but the plan is to add an This approach obviously wouldn't let you pipe in the "shift" amount; that would have to be done somewhat differently (and is part of the complexity of the "shift" ability).
Ooof, not easily. As far as CSS is concerned, the insides of an iframe are completely invisible to the outer page; the iframe is just an opaque rectangle, no different from an In theory we could do something about this, but it would be pretty novel. I'm not sure if the layout of iframe contents is tied to the rendering timing of the outer page (it's certainly undefined by CSS, but HTML may or may not say something about it); if not, this is even more troublesome.
It's not in the current spec, but that information is available. Could you describe some use-cases for it (preferably in a CSSWG issue)?
Right, not currently available. In theory it's doable - it would rely on the same sort of information that the fallback/overflow calculation does - but it wasn't brought up as a use-case early. If there are use-cases, we can def pursue it in the future, tho.
This actually isn't possible currently, but it's something I believe definitely needs to be done as part of the initial implementation. I haven't written it up yet because there are some details that weren't certain, but it sounds like y'all have made these decisions already, presumably with good reasons. ^_^ If I'm reading this correctly, y'all's implementation lets you choose between hiding when (a) the positioned element is fully outside of the anchor's containing block (or nearest scrollport?), or (b) the anchor is fully scrolled out of its nearest scroller, or (c) both. Plus a margin changing the size of the positioned element or anchor, as appropriate. Is this right? Do y'all find both of these important? Is there anything else you wish you would or could do in this space?
We don't have one yet, but have an open issue for matching the pointer, at least: w3c/csswg-drafts#8639. Absolutely possible, there's nothing weird about the timing here. Do y'all have use-cases for stuff beyond the pointer? (Hm, I suppose the "position relative to an element inside an iframe" is a reasonable use-case.) |
Beta Was this translation helpful? Give feedback.
-
I opened an issue that I think addresses this a few days ago w3c/csswg-drafts#8724, letting you select an element to use for your overflow calculations (rather than using the positioned element's CB). Would this work?
Hm, this comes out of the fact that it just uses the CB of the positioned element, and that's based on the layout viewport (for fixpos and top-layer stuff). But opting a fixpos into the visual viewport is something we've thought about at least some; @bramus would have a little more info about that, probably. Worst case, the API I mention above for selecting your containment box could be extended to allow this; the syntax would allow it no problem.
This is fixed now; specifying
I believe I addressed all of these in my preceding response. Please let me know if there are any details I missed responding to! |
Beta Was this translation helpful? Give feedback.
-
There’s been some discussion going on in w3c/csswg-drafts#7475 about this, where a new type of viewport has been suggested: the “PosFixedViewport” aka “Unzoomed Visual Viewport”. It has the size of the Visual Viewport, but its size is not affected by pinch-zoom – similar to how the Layout Viewport’s size is not affected by pinch-zoom. In the visual below (from this interactive demo), you can see the Layout Viewport (blue), Visual Viewport (red), and the Unzoomed Visual Viewport (green): The linked-to issue is leaning towards introducing this new type of viewport, but it still undecided on making it the default or doing it via an opt-in (which I am leaning to) However, should that new type of viewport land, it doesn’t cover scenarios where the anchor is not Preferably – and I think this is what the OP is suggesting – when trying to position the anchored element, the logic should try and take the presence of the virtual keyboard (or any other interactive widget for that matter) into account. This would play nice not only with full-width virtual keyboards, but also with split-keyboards – You wouldn’t want the anchored element to be rendered underneath any of those interactive widgets or parts thereof. I can see how this would complicate things implementation-wise, though. |
Beta Was this translation helpful? Give feedback.
-
The spec has evolved quite a bit after these months. Adding to the previous answers:
We've decided to add a new property for this purpose: w3c/csswg-drafts#8724 It should get into the spec soon.
|
Beta Was this translation helpful? Give feedback.
-
Hi Floating-UI experts, |
Beta Was this translation helpful? Give feedback.
-
Hey 👋
Wanted to start by saying great work with both popper and floating-ui 👏 I read a statistic that popper is used in almost 4% of websites!
From #1804 you're likely aware there is a CSS Anchoring API in the works that got recently promoted to "Editors Draft" in the specs: drafts.csswg.org/css-anchor-1/. I think the fact this spec exists is likely a great testament to the work you've been doing.
We were wondering if you had any thoughts on the spec? Or what do you think would be really important to be included in the spec? Could a CSS interface be useful for popper and floating-ui?
Your insight would be great as someone who's pretty close to the subject. The API is currently available to experiment with in Chrome Canary behind the "Experimental Web Platform Features" flag and I've got a few demos I'd be happy to share if you're interested.
Keep up the great work!
@jh3y ʕ •ᴥ•ʔ
Beta Was this translation helpful? Give feedback.
All reactions