Skip to content

Layers, Tooltip, HoverCard - #14

Merged
cixzhang merged 5 commits into
mainfrom
layers
Jan 17, 2026
Merged

cixzhang merged 5 commits into
mainfrom
layers

Conversation

@cixzhang

@cixzhang cixzhang commented Jan 16, 2026 •

Copy link
Copy Markdown
Contributor

Adding the layer system build on the new CSS Anchor Positioning API.

  • useXDSLayer -- This is the base layer utility using CSS anchor positioning. It sets up refs, anchor CSS, and enables opening and closing the layer. It does not handle accessibility -- this would need to be handled by the callers because the way layers can be applied and their purpose can be different. It has 2 positioning modes: context-based using anchor positioning or fixed positioning using x/y relative to the viewport.
  • useXDSTooltip, XDSTooltip -- A rebuild of our current versions. The hook is more or less what we had using the new layer primitive. Unfortunately, I couldn't get the new React FragmentRefs working due to anchor positioning requiring CSS styling. However, I wanted to avoid needing styling on these wrapper components so they are display: contents. As a result, the anchor CSS needs to be applied on the child of the wrapper, so there's quite a bit of logic to try to do this in a robust way. For example, we can also wrap text nodes rather than elements and those need to be handled differently.
  • useXDSHoverCard, XDSHoverCard -- This is similar to the tooltip but has additional accessibility requirements since it can contain interactive elements and would require keyboard users to be able to traverse into the hovercard. The way this works is by allowing the contents of the hovercard to be in tab order while the hovercard is visible. Escape while the hovercard is visible will still close the hovercard and restore focus on the trigger. Finally we have some focus trigger options that depend on the trigger itself. Some triggers are already interactive so there's no need to add another tab stop. Others might not be. In the case of text nodes, we will always inject tabIndex="0" to create a tab stop for text with hovercards.

As another accessibility update, both tooltip and hovercard, if it wraps text nodes, will by default include hover indicators. We preserve the hasHoverIndication option to either disable or enable this in other situations.

Video for keyboard + VO behavior: [internal video removed]

Screenshot 2026-01-16 at 9 32 26 AM Screenshot 2026-01-16 at 9 32 13 AM

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jan 16, 2026
@cixzhang
cixzhang requested a review from liyalabubu January 17, 2026 00:12

@liyalabubu liyalabubu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks Good To Me

@cixzhang
cixzhang merged commit e6ecf23 into main Jan 17, 2026
2 checks passed
@cixzhang
cixzhang deleted the layers branch January 17, 2026 01:32
cixzhang added a commit that referenced this pull request Apr 26, 2026
* add claude md

* Adding layer system, hovercards, tooltips

* stop propagation for the hovercard escape
kentonquatman added a commit that referenced this pull request Jul 26, 2026
- showRemoveOn="hover": reveal the remove button on any touch-capable
  device via @media (any-pointer: coarse) so hybrid touchscreen laptops
  (hover: hover + a touchscreen) are no longer left without a remove path.
- Remove button backing now uses the semantic --color-overlay token
  instead of a hardcoded scrim, dropping the no-hardcoded-styles bypass.
- Revert the image hairline to --color-border and instead make the
  neutral theme's light-mode --color-border a translucent black
  (#14) so the edge reads over tinted surfaces and images.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants