Skip to content
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

fix(overflow-menu): use offsetWidth, offsetHeight to compute menu dimensions #1913

Merged
merged 1 commit into from
Feb 25, 2024

Conversation

Sahasrara
Copy link
Contributor

No description provided.

@metonym
Copy link
Collaborator

metonym commented Feb 24, 2024

Could you provide an example or some context as to what this solves?

@Sahasrara
Copy link
Contributor Author

Could you provide an example or some context as to what this solves?

Oh sorry, so specifically I was using these dropdowns nested inside an element with scale transformation applied to it. The client rect calculations actually takes the scale into account so if you use those values to position the dropdown menu, the menu will appear in the wrong position in that context.

Here's a much more specific example:
https://svelteflow.dev/examples

Imagine a dropdown on one of the nodes in the graph on this page. The position of the dropdown will be incorrect if you zoom in or out since they use transform scale.

Copy link
Collaborator

@metonym metonym left a comment

Choose a reason for hiding this comment

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

Seems like a reasonable approach.

@metonym metonym changed the title Make overflow menu account for transform scale fix(overflow-menu): use offsetWidth, offsetHeight to compute menu dimensions Feb 25, 2024
@metonym metonym merged commit 2404244 into carbon-design-system:master Feb 25, 2024
1 check passed
@metonym
Copy link
Collaborator

metonym commented Feb 26, 2024

Released in v0.82.11.

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