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

feat: contextual menu css position #4915

Conversation

petermakowski
Copy link
Contributor

@petermakowski petermakowski commented Nov 22, 2023

Done

This PR removes the need for using JavaScript for vertical positioning of the contextual menu and will subsequently allow to simplify implementations of this pattern.

  • feat: contextual menu css position

QA

  • Open demo
  • Go to /docs/patterns/contextual-menu and ensure all examples are displayed exactly the same as before

Check if PR is ready for release

If this PR contains Vanilla SCSS code changes, it should contain the following changes to make sure it's ready for the release:

  • PR should have one of the following labels to automatically categorise it in release notes:
    • Feature 🎁, Breaking Change 💣, Bug 🐛, Documentation 📝, Maintenance 🔨.
  • Vanilla version in package.json should be updated relative to the most recent release, following semver convention:
    • if CSS class names are not changed it can be bugfix relesase (x.x.X)
    • if CSS class names are changed/added/removed it should be minor version (x.X.0)
    • see the wiki for more details
  • Any changes to component class names (new patterns, variants, removed or added features) should be listed on the what's new page.

Screenshots

No visual changes, looks exactly the same way as before. E.g.:
Google Chrome screenshot 001104@2x

Notes

Somewhat related PR in react-components: canonical/react-components#1000

@petermakowski petermakowski force-pushed the feat-contextual-menu-css-position branch from e1c2dd3 to b4378c9 Compare November 22, 2023 14:58
@petermakowski petermakowski marked this pull request as ready for review November 22, 2023 14:58
@petermakowski petermakowski requested a review from bartaz November 22, 2023 14:59
@@ -16,7 +16,7 @@
@extend %vf-has-box-shadow;

display: none;
margin: 0;
margin: 0 0 $input-margin-bottom 0;
Copy link
Member

Choose a reason for hiding this comment

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

How is margin on the dropdown related to placement?

Contextual menu is absolutely positioned, so I'm not sure if bottom margin on it affects anything?

@@ -83,6 +83,8 @@
}

.p-contextual-menu__toggle {
// Remove margin bottom for the dropdown menu to be aligned with the toggle
margin-bottom: 0;
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure if we can do that. In our example p-contextual-menu__toggle is used on the button, and in such case it would override the default margin on the button.

The fact that button has contextual menu should not affect its margin.

I guess this was the main reason to use JS for positioning - so we can calculate top position regardless of margin that element having contextual menu may have.

@bartaz
Copy link
Member

bartaz commented Jul 24, 2024

This seems stale. Feel free to reopen/revisit @petermakowski if it's still needed.

@bartaz bartaz closed this Jul 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants