-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
[HOLD for payment 2024-01-26] [$500] Emoji - When resizing the window, the open emoji picker moves to the LHN side #31155
Comments
Triggered auto assignment to @lschurr ( |
Job added to Upwork: https://www.upwork.com/jobs/~01b9e60337c2ef461a |
Bug0 Triage Checklist (Main S/O)
|
Triggered auto assignment to Contributor-plus team member for initial proposal review - @aimane-chnaif ( |
ProposalPlease re-state the problem that we are trying to solve in this issue.
What is the root cause of that problem?
App/src/components/EmojiPicker/EmojiPicker.js Line 132 in e2c1c03
What changes do you think we should make in order to solve the problem?
App/src/components/EmojiPicker/EmojiPicker.js Lines 124 to 135 in e2c1c03
Below example is for // `emojiPopoverAnchor.current` is the original ref of the anchor element from `EmojiPickerButton.js`
useDimensionChange(() => EmojiPickerAction.onAnchorDimensionChange(emojiPopoverAnchor.current)); Video for EmojiPickerButton.jsvideoc8046c9e-f613-4550-b13f-b300ef68a079.mp4What alternative solutions did you explore? (Optional)
|
ProposalPlease re-state the problem that we are trying to solve in this issue.When resizing the window, the open emoji picker moves to the LHN side What is the root cause of that problem?When we resize the window, the ref of the emoji button here will change, however, since we only passed the value ( What changes do you think we should make in order to solve the problem?The way we're passing refs as params to other components are not ideal, that way the original ref and the ref that we pass can get out of sync, causing issues like this one. So the pattern that we use is usually:
And replace this
And we don't need to pass the ref from the What alternative solutions did you explore? (Optional)We can just add another method Any place that has this issue can be fixed the same way by the main or alternative approach, but the main approach is global. |
ProposalPlease re-state the problem that we are trying to solve in this issue.Resizing the browser window moves the emoji picker to the left side of the screen. What is the root cause of that problem?In EmojiPicker, we have a dimension change listener to calculate a new position. App/src/components/EmojiPicker/EmojiPicker.js Lines 124 to 135 in d4a97bc
The problem is, that the x, y, w, and h returned from This is because the element we want to measure ( The element becomes not available as soon as the emoji picker menu shows. Why? The emoji picker button is wrapped with a PopoverAnchorTooltip. App/src/components/EmojiPicker/EmojiPickerButton.js Lines 38 to 40 in d4a97bc
PopoverAnchorTooltip will conditionally render the element with/without a tooltip based on the popover visibility. App/src/components/Tooltip/PopoverAnchorTooltip.js Lines 40 to 52 in d4a97bc
When we first open the web, the emoji picker button is rendered with a tooltip, but when the emoji picker popover shows, we render the emoji picker button without a tooltip. This becomes a problem because if we render it with a tooltip, we clone the children (in this case the emoji picker button). So, both elements are different instances and the element that we pass to the EmojiPicker is the element of the with a tooltip.
What changes do you think we should make in order to solve the problem?Instead of passing the element as the -EmojiPickerAction.showEmojiPicker(props.onModalHide, props.onEmojiSelected, emojiPopoverAnchor.current, undefined, () => {}, props.emojiPickerID);
+EmojiPickerAction.showEmojiPicker(props.onModalHide, props.onEmojiSelected, emojiPopoverAnchor, undefined, () => {}, props.emojiPickerID); We should make the above changes to every usage of EmojiPickerAction.showEmojiPicker Then, we need to modify EmojiPicker so it works with the ref, that is by accessing the element by using double App/src/components/EmojiPicker/EmojiPicker.js Lines 51 to 58 in 358e4b1
App/src/components/EmojiPicker/EmojiPicker.js Lines 125 to 132 in 358e4b1
the first .current is to access the Last, we need to modify below code so it pass the correct ref to the popover App/src/components/EmojiPicker/EmojiPicker.js Line 157 in 358e4b1
|
@lschurr, @aimane-chnaif Whoops! This issue is 2 days overdue. Let's get this updated quick! |
reviewing proposals |
Contributor details |
|
ProposalPlease re-state the problem that we are trying to solve in this issue.When resizing the window on the web browser, the open emoji picker moves to the LHN side. What is the root cause of that problem?The issue is exclusively observed in web browsers when users interact using a mouse. I conducted tests on a touchscreen device and encountered no problems. Further testing in Google Chrome's DevTools using the 'toggle device' option and responsive layout modes also did not reproduce the issue. The specific problem arises when a user clicks the emoji button. This action triggers the addition of a What changes do you think we should make in order to solve the problem?To address the issue, we can implement a detection mechanism to ascertain if the user is interacting via a mouse. In scenarios where the window is being resized, we can strategically hide the Emoji Picker. This approach maintains the existing user experience on touchscreen devices, while effectively resolving the issue on desktops and laptops. By hiding the Emoji Picker during window resizing and only displaying it again upon user click, we ensure a seamless experience across different devices. // state for user using a mouse
const [isUsingMouse, setIsUsingMouse] = useState(false);
useEffect(() => {
const handleMouseMove = () => {
setIsUsingMouse(true);
// Remove the event listener after detecting mouse movement
window.removeEventListener('mousemove', handleMouseMove);
};
if (!isUsingMouse) {
window.addEventListener('mousemove', handleMouseMove);
}
const emojiPopoverDimensionListener = Dimensions.addEventListener('change', () => {
if (isUsingMouse) {
hideEmojiPicker();
}
// rest of the code ..
return () => {
emojiPopoverDimensionListener.remove();
window.removeEventListener('mousemove', handleMouseMove);
};
}, [isEmojiPickerVisible, isSmallScreenWidth, emojiPopoverAnchorOrigin]); What alternative solutions did you explore? (Optional)
|
📣 @dragnoir! 📣
|
Contributor details |
✅ Contributor details stored successfully. Thank you for contributing to Expensify! |
ProposalPlease re-state the problem that we are trying to solve in this issue.When resizing the window on the web browser, the open emoji picker moves to the LHN side. What is the root cause of that problem?I was reviewing my last proposal and with more testing, it seems that I am wrong, it's not about the style on the DOM. I checked more about the element position and the best practice to it and I found that EmojiPickerButton is not structured the way it's recommanded for What changes do you think we should make in order to solve the problem?The return of EmojiPickerButton.js should be embedded inside a view where the refs should be. import {View} from 'react-native';
return (
<View
ref={emojiPopoverAnchor}
>
<Tooltip text={props.translate('reportActionCompose.emoji')}>
<PressableWithoutFeedback
// rest of the code
</PressableWithoutFeedback>
</Tooltip>
</View>
); so moving Video after the code updatebrowser_resize.mp4What alternative solutions did you explore? (Optional)
|
@aimane-chnaif can you review the proposals here? |
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
reviewing |
Hi @aimane-chnaif @bernhardoj @neil-marcellini - Could someone take a look here and let me know how to proceed? Has the regression been fixed? |
not fixed yet |
Any update @aimane-chnaif? |
PR is in review. Not yet in mergeable state |
Yep, under review. |
|
The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.27-1 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue: If no regressions arise, payment will be issued on 2024-01-26. 🎊 For reference, here are some details about the assignees on this issue:
|
BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:
|
@aimane-chnaif - Can you work through the checklist on this one? |
|
It looks like the automation didn't work here. Moving to Daily and will handle payments shortly. |
Payment summary:
|
Offers sent in Upwork. |
Offer accepted already - #31155 (comment) |
Ah, sorry about that! I'll use the previous offers. |
Payments issued. Closing this one out. |
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Version Number: 1.3.97-0
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: Applause - Internal Team
Slack conversation:
Action Performed:
Expected Result:
Emoji picker should be fixed above the Compose Box when resizing the window and should remain open when going into mobile mode
Actual Result:
When resizing the window, the open emoji picker moves to the LHN side
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Add any screenshot/video evidence
Bug6270312_1699554384569.Recording__692.mp4
View all open jobs on GitHub
Upwork Automation - Do Not Edit
The text was updated successfully, but these errors were encountered: