-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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(FloatingMenu): lazy evaluate trigger button position #5881
Merged
asudoh
merged 2 commits into
carbon-design-system:master
from
asudoh:floating-menu-lazy-evaluate-trigger-position
Apr 17, 2020
Merged
fix(FloatingMenu): lazy evaluate trigger button position #5881
asudoh
merged 2 commits into
carbon-design-system:master
from
asudoh:floating-menu-lazy-evaluate-trigger-position
Apr 17, 2020
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This change switches the position calculation logic for the trigger buttons of `<OverflowMenu>` and `<Tooltip>` from eager-evaluation on mount to lazy-evaluation on rendering `<FloatingMenu>`. This change relegates such logic from `<OverflowMenu>` and `<Tooltip>` to `<FloatingMenu>` to do that. Such change has two merits: 1. Avoids stale trigger position data, which happened when `<Tooltip>` is opened programmatically 2. Reduces `getBoundingClientRect()` calls when application is initialized Also, swiches `<FloatingMenu>`'s prop for the DOM element ref of trigger button, as well as the corresponding internal properties of `<OverflowMenu>`/`<Tooltip>` from raw element to React ref. Fixes carbon-design-system#5305.
Deploy preview for carbon-elements ready! Built with commit b221a2b |
Deploy preview for carbon-components-react ready! Built with commit b221a2b https://deploy-preview-5881--carbon-components-react.netlify.app |
joshblack
approved these changes
Apr 17, 2020
emyarod
approved these changes
Apr 17, 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me
joshblack
pushed a commit
to joshblack/carbon
that referenced
this pull request
Apr 23, 2020
…gn-system#5881) This change switches the position calculation logic for the trigger buttons of `<OverflowMenu>` and `<Tooltip>` from eager-evaluation on mount to lazy-evaluation on rendering `<FloatingMenu>`. This change relegates such logic from `<OverflowMenu>` and `<Tooltip>` to `<FloatingMenu>` to do that. Such change has two merits: 1. Avoids stale trigger position data, which happened when `<Tooltip>` is opened programmatically 2. Reduces `getBoundingClientRect()` calls when application is initialized Also, swiches `<FloatingMenu>`'s prop for the DOM element ref of trigger button, as well as the corresponding internal properties of `<OverflowMenu>`/`<Tooltip>` from raw element to React ref. Fixes carbon-design-system#5305.
joshblack
pushed a commit
to joshblack/carbon
that referenced
this pull request
Apr 23, 2020
…gn-system#5881) This change switches the position calculation logic for the trigger buttons of `<OverflowMenu>` and `<Tooltip>` from eager-evaluation on mount to lazy-evaluation on rendering `<FloatingMenu>`. This change relegates such logic from `<OverflowMenu>` and `<Tooltip>` to `<FloatingMenu>` to do that. Such change has two merits: 1. Avoids stale trigger position data, which happened when `<Tooltip>` is opened programmatically 2. Reduces `getBoundingClientRect()` calls when application is initialized Also, swiches `<FloatingMenu>`'s prop for the DOM element ref of trigger button, as well as the corresponding internal properties of `<OverflowMenu>`/`<Tooltip>` from raw element to React ref. Fixes carbon-design-system#5305.
joshblack
pushed a commit
that referenced
this pull request
Apr 23, 2020
This change switches the position calculation logic for the trigger buttons of `<OverflowMenu>` and `<Tooltip>` from eager-evaluation on mount to lazy-evaluation on rendering `<FloatingMenu>`. This change relegates such logic from `<OverflowMenu>` and `<Tooltip>` to `<FloatingMenu>` to do that. Such change has two merits: 1. Avoids stale trigger position data, which happened when `<Tooltip>` is opened programmatically 2. Reduces `getBoundingClientRect()` calls when application is initialized Also, swiches `<FloatingMenu>`'s prop for the DOM element ref of trigger button, as well as the corresponding internal properties of `<OverflowMenu>`/`<Tooltip>` from raw element to React ref. Fixes #5305.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change switches the position calculation logic for the trigger buttons of
<OverflowMenu>
and<Tooltip>
from eager-evaluation on mount to lazy-evaluation on rendering<FloatingMenu>
.This change relegates such logic from
<OverflowMenu>
and<Tooltip>
to<FloatingMenu>
to do that.Such change has two merits:
<Tooltip>
is opened programmaticallygetBoundingClientRect()
calls when application is initializedAlso, swiches
<FloatingMenu>
's prop for the DOM element ref of trigger button, as well as the corresponding internal properties of<OverflowMenu>
/<Tooltip>
from raw element to React ref.Fixes #5305.
Changelog
Changed
Testing / Reviewing
Testing should make sure
<OverflowMenu>
and<Tooltip>
are not broken.