Context Menu

A small dropdown menu that anchors itself to the button that triggered it, using CSS Anchor Positioning and the Popover API.

Anchored Context Menu (Anchor Popover)

Uses the latest CSS Anchor Positioning standard and the Popover API - the positioning and animations are pure CSS.

<!-- 1. Trigger button (defines the anchor name) -->
<button popovertarget="menu1" style="anchor-name: --btn1;" class="btn btn-secondary">
  Options
</button>

<!-- 2. Context menu (anchors itself to the anchor) -->
<div id="menu1" popover class="popover-context" style="position-anchor: --btn1;">
  <ul class="popover-action-list">
    <li><button class="popover-action-btn">Edit</button></li>
    <li><button class="popover-action-btn text-danger">Delete</button></li>
  </ul>
</div>