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: popup closes on context menu copy #1453

Merged
merged 11 commits into from
Oct 16, 2024

Conversation

astandrik
Copy link
Collaborator

@astandrik astandrik commented Oct 11, 2024

Closes #1452

Stand

Problem:

Screen.Recording.2024-10-11.at.13.58.58.mov

CI Results

Test Status: ⚠️ FLAKY

📊 Full Report

Total Passed Failed Flaky Skipped
134 132 0 2 0

Bundle Size: 🔺

Current: 78.96 MB | Main: 78.95 MB
Diff: +0.00 MB (0.01%)

⚠️ Bundle size increased. Please review.

ℹ️ CI Information
  • Test recordings for failed tests are available in the full report.
  • Bundle size is measured for the entire 'dist' directory.
  • 📊 indicates links to detailed reports.
  • 🔺 indicates increase, 🔽 decrease, and ✅ no change in bundle size.

@astandrik astandrik self-assigned this Oct 14, 2024
@astandrik
Copy link
Collaborator Author

@Raubzeug @artemmufazalov ping

@@ -0,0 +1,5 @@
@import '../../styles/mixins.scss';
Copy link
Contributor

Choose a reason for hiding this comment

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

seems to be redundant

</div>
<Popup
contentClassName={b()}
anchorRef={anchorRef || anchor}
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we allow to pass anchorRef? Won't it break behaviour set by us?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We allow to pass anchorRef for custom anchors if they are needed
if anchorRef is not passed - default anchor from component is used

Comment on lines +65 to +85
const onPopupMouseEnter = React.useCallback(() => {
setIsPopupContentHovered(true);
}, []);

const onPopupMouseLeave = React.useCallback(() => {
setIsPopupContentHovered(false);
}, []);

const onPopupContextMenu = React.useCallback(() => {
setIsFocused(true);
}, []);

const onPopupBlur = React.useCallback(() => {
setIsFocused(false);
}, []);

const onPopupEscapeKeyDown = React.useCallback(() => {
setIsFocused(false);
setIsPopupContentHovered(false);
hidePopup();
}, [hidePopup]);
Copy link
Contributor

Choose a reason for hiding this comment

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

do we really need all these useCallback?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes
because we pass this function as prop to external component which may use this function as prop

@astandrik astandrik requested a review from Raubzeug October 16, 2024 14:27
@astandrik astandrik added this pull request to the merge queue Oct 16, 2024
Merged via the queue into main with commit 9daa5a3 Oct 16, 2024
6 checks passed
@astandrik astandrik deleted the astandrik.popup-closes-on-context-menu-copy-1452 branch October 16, 2024 14:58
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.

popup closes on context menu copy
2 participants