Skip to content

Refactor select overlay positioning with CDK ConnectedPosition#1389

Open
klagrida wants to merge 1 commit intomainfrom
claude/fix-sc-select-overlay-5iptz
Open

Refactor select overlay positioning with CDK ConnectedPosition#1389
klagrida wants to merge 1 commit intomainfrom
claude/fix-sc-select-overlay-5iptz

Conversation

@klagrida
Copy link
Collaborator

Summary

Refactored the select component's overlay positioning to use explicit ConnectedPosition configurations instead of the inline overlay configuration object. This provides better control over positioning behavior and fallback strategies.

Key Changes

  • Added ConnectedPosition[] array with two positioning strategies:
    • Primary: overlay below the trigger, aligned to start with 4px offset
    • Fallback: overlay above the trigger when insufficient space below, with -4px offset
  • Updated cdkConnectedOverlay binding to use individual property bindings:
    • [cdkConnectedOverlayOrigin] for the origin element
    • [cdkConnectedOverlayPositions] for the position strategies
    • [cdkConnectedOverlayMinWidth] for width matching
  • Removed usePopover: 'inline' and matchWidth: true from inline configuration
  • Added triggerWidth() computed signal to dynamically provide the trigger element's width
  • Removed mt-1 (margin-top) from select-popup styling since spacing is now handled by the offsetY positioning configuration

Implementation Details

The new approach separates concerns by:

  1. Defining positioning strategies as a constant, making them reusable and testable
  2. Using individual CDK overlay bindings for clearer intent and better type safety
  3. Leveraging computed signals to reactively provide the trigger width for overlay sizing
  4. Allowing the CDK overlay to automatically flip between positions based on available viewport space

https://claude.ai/code/session_01MEbQJiNKarA74je1KFZUQF

Replace inline popover overlay with traditional cdkConnectedOverlay
using ConnectedPosition array so the dropdown automatically flips
above the trigger when there is not enough space below.

https://claude.ai/code/session_01MEbQJiNKarA74je1KFZUQF
@klagrida klagrida force-pushed the claude/fix-sc-select-overlay-5iptz branch from 3ccbff6 to 3e31737 Compare February 23, 2026 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants