Skip to content

Conversation

@hanneskuettner
Copy link
Contributor

@hanneskuettner hanneskuettner commented Apr 17, 2025

πŸ”— Linked issue

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

This PR adds the correct transform-origin to all components that use popper under the hood.

This allows the scale animation to properly animate from the triggering element (and popper position) and leads to animations that are a lot more connected to the element that is triggering the popper. See these two examples where I exaggerated the scale animation scaling and duration:

Before After
CleanShot.2025-04-17.at.09.10.13.mp4
CleanShot.2025-04-17.at.09.09.58.mp4
CleanShot.2025-04-17.at.08.56.31.mp4
CleanShot.2025-04-17.at.08.56.53.mp4

I've opted to use the documented transform origin CSS variables that reka publishes as opposed to the --popper ones, which leads to a slightly suboptimal setup in select-menu.ts.

On the other hand, I see that select already uses the "raw" popper variable for the width, so maybe that is actually something we are okay with doing as well, even if it strictly speaking isn't public API? Happy to change it!

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Apr 17, 2025

npm i https://pkg.pr.new/@nuxt/ui@3919

commit: a5d7a68

@benjamincanac benjamincanac changed the title feat: respect transform-origin in popper components fix(components): respect transform-origin in popper content Apr 17, 2025
Copy link
Member

@benjamincanac benjamincanac left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! I've updated the select-menu to use defuFn instead of string interpolation. It's perfectly fine to use those variables, I would just change the --reka-popper-* variables for consistency.

@hanneskuettner
Copy link
Contributor Author

I've updated the select-menu to use defuFn instead of string interpolation.

A lot cleaner! Thank you!

I would just change the --reka-popper-* variables for consistency.

Done for the components that were touched in this PR

@benjamincanac benjamincanac merged commit 01d8dc7 into nuxt:v3 Apr 17, 2025
5 checks passed
@benjamincanac benjamincanac added the v3 #1289 label Apr 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v3 #1289

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants