Skip to content

Ability to anchor a popover to the native selection rectangle using CSS Anchor Positioning #518

@michael

Description

@michael

This is up for discussion, but it would be a great thing for editor developers like myself to be able to anchor a popover (using CSS Anchor Positioning) not just to elements in the DOM, but to the native DOM Selection.

Then workarounds like rendering a span to be used as an anchor wouldn't be required anymore (see #516).

Proposal: Use a reserved anchor name (e.g. --dom-selection-rectangle) that the browser sets up automatically and that you can then use to position your popover.

.create-link-popover {
  position-anchor: --dom-selection-rectangle;
  /* other props */
  position: absolute;
  position-area: block-end span-all;
  justify-self: anchor-center;
  pointer-events: auto;
  z-index: 30;
  position-try-fallbacks: flip-block;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels
    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions