Skip to content

Conversation

britt6612
Copy link
Collaborator

What does this PR do?

This PR address that tip.drop.margin should take priority over global.drop.margin currently in our hpe theme we have global.drop.margin set as well as intelligentMargin so whats happening is those are being applied to Tip even though we have tip.drop.margin set to "none"

I have add the check that if marginProp is set to something then that should come before the adjustedMargin in the marginStyle function in Drop.

Where should the reviewer start?

styledDrop

What testing has been done on this PR?

locally

How should this be manually tested?

locally

in hpe theme you will see that the only margin being applied is the theme.tip.content.margin in which we will update this value in the hpe them to either 6px or 9px depending on discussion with designers.

Do Jest tests follow these best practices?

  • screen is used for querying.
  • The correct query is used. (Refer to this list of queries)
  • asFragment() is used for snapshot testing.

Any background context you want to provide?

margin on the drop was causing the tooltip not to stay open as a user hovered from the target to the tooltip

What are the relevant issues?

closes #7552

Screenshots (if appropriate)

Do the grommet docs need to be updated?

no

Should this PR be mentioned in the release notes?

yes

Is this change backwards compatible or is it a breaking change?

backwards compatible

@britt6612 britt6612 requested review from MikeKingdom and taysea April 22, 2025 19:31
@@ -54,7 +54,7 @@ const marginStyle = (theme, align, data, responsive, marginProp) => {
}
return edgeStyle(
'margin',
adjustedMargin,
marginProp || adjustedMargin,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this way marginProp that is set to 'none' will come before adjustedMargin

Copy link
Collaborator

@taysea taysea left a comment

Choose a reason for hiding this comment

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

I am comfortable with this. Upon initial review, I was wondering if theme.tip.drop.margin should also adhere to "intelligentMargin" (which would make the margin alignment aware). In looking at the implementation of Tip, "theme.tip.drop" is passed onto Drop as a prop, so allowing for that would further complicate this logic.

Given the use case of Tip with mouseover should ideally be leaving margin as none anyway, I'm comfortable with this.

@britt6612
Copy link
Collaborator Author

I am comfortable with this. Upon initial review, I was wondering if theme.tip.drop.margin should also adhere to "intelligentMargin" (which would make the margin alignment aware). In looking at the implementation of Tip, "theme.tip.drop" is passed onto Drop as a prop, so allowing for that would further complicate this logic.

Given the use case of Tip with mouseover should ideally be leaving margin as none anyway, I'm comfortable with this.

yes I looked into theme.tip.drop.margin adhering to the intelligentMargin but knew the logic would of been complicated so figured if we were okay with the margin being on all sides this was the cleanest direction

Copy link
Collaborator

@jcfilben jcfilben left a comment

Choose a reason for hiding this comment

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

Looks good!

@jcfilben jcfilben merged commit 7cbb21f into grommet:master Apr 29, 2025
13 of 14 checks passed
@jcfilben jcfilben changed the title look at marginProp before setting adjustedMargin Tip - look at marginProp before setting adjustedMargin Jun 5, 2025
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.

Tip — Enhance to support ability to dismiss and ability to move cursor into content
3 participants