Skip to content

[popups] Allow Positioner parts to be omitted #1668

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

atomiks
Copy link
Contributor

@atomiks atomiks commented Apr 3, 2025

Closes #1663

CSS anchor positioning preview: https://deploy-preview-1668--base-ui.netlify.app/experiments/css-anchor-positioning

Limitations:

  • You can't use Arrow parts without Positioner
  • --transform-origin doesn't work
  • Positioning acts differently (no shifting)
  • Doesn't apply to Select since it requires JavaScript

@atomiks atomiks added the component: popover This is the name of the generic UI component, not the React module! label Apr 3, 2025
Copy link

netlify bot commented Apr 3, 2025

Deploy Preview for base-ui ready!

Name Link
🔨 Latest commit bb80995
🔍 Latest deploy log https://app.netlify.com/sites/base-ui/deploys/67ee479f6f98260008a8a7b9
😎 Deploy Preview https://deploy-preview-1668--base-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@atomiks atomiks force-pushed the fix/allow-omit-positioner branch from 4bf1062 to 03bdef5 Compare April 3, 2025 08:11
Comment on lines +21 to +56
@position-try --block-end {
position-area: block-end;
}
@position-try --block-end-start {
position-area: block-end span-inline-end;
}
@position-try --block-end-end {
position-area: block-end span-inline-start;
}
@position-try --block-start {
position-area: block-start;
}
@position-try --block-start-start {
position-area: block-start span-inline-end;
}
@position-try --block-start-end {
position-area: block-start span-inline-start;
}
@position-try --inline-start {
position-area: inline-start;
}
@position-try --inline-start-start {
position-area: inline-start span-block-end;
}
@position-try --inline-start-end {
position-area: inline-start span-block-start;
}
@position-try --inline-end {
position-area: inline-end;
}
@position-try --inline-end-start {
position-area: inline-end span-block-end;
}
@position-try --inline-end-end {
position-area: inline-end span-block-start;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Don't really know if there's any easier way to ensure center-aligned popups don't overflow their inline axis (aka something close to shift() in Floating UI)

position-try-fallbacks:
  --block-end, --block-start-start, --block-start-end, --block-end-start, --block-end-end;

@atomiks
Copy link
Contributor Author

atomiks commented Apr 8, 2025

CSS anchoring demo isn't final but this solves the issue of Positioner parts not being allowed to be omitted

@atomiks atomiks marked this pull request as ready for review April 8, 2025 08:40
@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Apr 16, 2025
Copy link
Member

@michaldudak michaldudak left a comment

Choose a reason for hiding this comment

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

Menus don't work without the Positioner as this part is also responsible for rendering FloatingNode and CompositeList.
Additionally, since Positioners render InternalBackdrops, modality won't fully work without them. Both of these issues could be solved by moving all non-positioning logic from Positioners to Popups

Copy link
Member

Choose a reason for hiding this comment

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

Whenever the popup is open, both horizontal and vertical scrollbars appear on the viewport

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I noticed this too and I think this is some bug with CSS anchoring in scroll containers :\

@benface
Copy link

benface commented Apr 17, 2025

Could the Portal part also be made optional, to render menus inline?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: popover This is the name of the generic UI component, not the React module! PR: out-of-date The pull request has merge conflicts and can't be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[popups] Allow Positioner parts to be omitted for native CSS anchoring
3 participants