Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

docs(layer-runtime, HoverCard): a trigger inside SVG foreignObject cannot be a CSS anchor in Chromium (#10908)

Cindy Zhang438a0ff88855
diff --git a/.changeset/hovercard-foreignobject-limitation.md b/.changeset/hovercard-foreignobject-limitation.md
new file mode 100644
index 0000000000..d9662c493d
--- /dev/null
+++ b/.changeset/hovercard-foreignobject-limitation.md
@@ -0,0 +1,7 @@
+---
+'@astryxdesign/core': patch
+---
+
+[docs] HoverCard: a trigger inside SVG `<foreignObject>` cannot be a CSS anchor in Chromium, so its card opens at the viewport corner. The docs now say so and show the fix: render the trigger in an HTML layer positioned over the SVG node.
+
+@cixzhang
diff --git a/docs/architecture/layer-runtime.md b/docs/architecture/layer-runtime.md
index 16f6ff3593..7974739487 100644
--- a/docs/architecture/layer-runtime.md
+++ b/docs/architecture/layer-runtime.md
@@ -147,6 +147,11 @@ can flip across either axis. Centered placements also gain span fallbacks so the
surface can move along the alignment axis near viewport edges. Clearance is
applied to both edges of the placement axis so a flip retains the gap.
+Known limitation: a trigger inside SVG `<foreignObject>` cannot be a CSS
+anchor in Chromium, so an anchored surface for it opens at the viewport corner.
+Place the trigger in an HTML layer over the SVG, positioned at the node's
+coordinates, and keep the SVG for shapes, edges, and labels.
+
#### Viewport inset
Anchor mode owns the viewport inset (`spec:AST-059`). Every anchor-mode layer
diff --git a/packages/core/src/HoverCard/HoverCard.doc.mjs b/packages/core/src/HoverCard/HoverCard.doc.mjs
index 51055bb73f..9922dcc84c 100644
--- a/packages/core/src/HoverCard/HoverCard.doc.mjs
+++ b/packages/core/src/HoverCard/HoverCard.doc.mjs
@@ -205,6 +205,11 @@ export const docs = {
description:
'Use a HoverCard for content the user must interact with; it disappears when the cursor leaves.',
},
+ {
+ guidance: false,
+ description:
+ 'Put the trigger inside SVG <foreignObject>. In Chromium it cannot be a CSS anchor, so the card opens at the viewport corner. Render the trigger in an HTML layer positioned over the SVG node instead, and keep the SVG for shapes, edges and labels.',
+ },
{
guidance: true,
description:
@@ -409,6 +414,11 @@ export const docsZh = {
description:
'Use a HoverCard for content the user must interact with; it disappears when the cursor leaves.',
},
+ {
+ guidance: false,
+ description:
+ 'Put the trigger inside SVG <foreignObject>. In Chromium it cannot be a CSS anchor, so the card opens at the viewport corner. Render the trigger in an HTML layer positioned over the SVG node instead, and keep the SVG for shapes, edges and labels.',
+ },
{
guidance: true,
description:
@@ -461,6 +471,11 @@ export const docsDense = {
description:
'Use a HoverCard for content the user must interact with; it disappears when the cursor leaves.',
},
+ {
+ guidance: false,
+ description:
+ 'Put the trigger inside SVG <foreignObject>: Chromium cannot anchor to it, so the card opens at the viewport corner. Use an HTML trigger positioned over the SVG node.',
+ },
{
guidance: true,
description: