core icon indicating copy to clipboard operation
core copied to clipboard

Dropdowns don't scroll with the page

Open ashleyryan opened this issue 3 years ago • 1 comments

Describe the bug

A cds-dropdown seems to stay pinned to it's position on the page instead of scrolling with it's anchor element if the page scrolls.

How to reproduce

https://stackblitz.com/edit/clarity-dark-theme-clr13-cds6-nlxpe6?file=src%2Fapp%2Fapp.component.html,src%2Fapp%2Fapp.component.ts

Steps to reproduce the behavior:

  1. Click on the i icon and scroll the page when the NG signpost opens. Notice how it scrolls with the anchor element
  2. Click on the button to open the cds-dropdown.
  3. Notice how the dropdown stays fixed while it's anchor scrolls away with the page.

Expected behavior

The dropdown should scroll with the anchor

Versions

Clarity project:

  • [x] Clarity Core
  • [ ] Clarity Angular/UI

Clarity version:

  • [ ] v5.x
  • [x] v6.x

ashleyryan avatar Oct 24 '22 18:10 ashleyryan

This seems to be related to the position: fixed set on the host element: https://github.com/vmware-clarity/core/blob/main/projects/core/src/internal-components/popup/popup.element.scss#L34 This is the same logic and css used for overlays like the modal overlay, so it looks like its all intended to be used like an overlay.

ashleyryan avatar Oct 24 '22 20:10 ashleyryan