Anchor Positioning is transform-aware in Chrome 144+

Starting with Chrome 144, Anchor Positioning is going to be transform-aware. From then on, anchoring will resolve against the bounding box of the transformed anchor.

Here’s a demo with two anchors. They both are positioned exactly in the middle of the page, but one of them is moved and scaled using a CSS transform.

Before Chrome 144, the tooltip on the right would appear above the anchor on the left. Huh?! This is because that’s where the anchor originally was, before it was transformed. Anchor positioning in Chrome prior to Chrome 144 used the untransformed bounding box to do its thing.

From Chrome 144, following a CSSWG resolution to change the spec, the tooltip on the right now considers the transformed bounding box when anchoring itself to the anchor, so it will end up above the anchor on the right (as you might have initially expected).

Here’s a screenshot taken in Chrome 144:

Screenshot of the demo taken in Chrome 144. Both tooltips are correctly positioned.

~

🔥 Like what you see? Want to stay in the loop? Here's how:

I can also be found on 𝕏 Twitter and 🐘 Mastodon but only post there sporadically.

Published by Bramus!

Bramus is a frontend web developer from Belgium, working as a Chrome Developer Relations Engineer at Google. From the moment he discovered view-source at the age of 14 (way back in 1997), he fell in love with the web and has been tinkering with it ever since (more …)

Unless noted otherwise, the contents of this post are licensed under the Creative Commons Attribution 4.0 License and code samples are licensed under the MIT License

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.