-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[$500] Make it possible to click the element the product training tooltip is pointing to. #54068
Comments
Job added to Upwork: https://www.upwork.com/jobs/~021867697197444537249 |
Current assignee @ishpaul777 is eligible for the External assigner, not assigning anyone new. |
Triggered auto assignment to @twisterdotcom ( |
Upwork job price has been updated to $500 |
Updating the price since this is part of an important migrate initiative. |
The core issue here is that operations that should happen outside of the render cycle are being executed at the wrong time and in the wrong way. Functions like useSharedValue and useState, which manage state, should be properly synchronized using hooks like useEffect. This ensures that side effects are handled outside of the render cycle, preventing unnecessary re-renders and ensuring smoother performance. Using useEffect: Values should not be updated directly during the render cycle. Instead, hooks like useEffect should be used to update values after the component is initially rendered or after specific dependencies change. This ensures that updates are done in a controlled manner and helps avoid unnecessary renders.
This approach ensures that values are updated only after the component has mounted, preventing unnecessary re-renders. Synchronized Value Management: Shared values with Conditional Checks: The |
📣 @storm21-tecn! 📣
|
|
Edited by proposal-police: This proposal was edited at the latest timestamp recorded during the edit. ProposalPlease re-state the problem that we are trying to solve in this issue.Make it possible to click the element the product training tooltip is pointing to. What is the root cause of that problem?New feature What changes do you think we should make in order to solve the problem?
Test branch:Previous solution
const handleOverlayClick = (event?: MouseEvent | KeyboardEvent) => {
// Captures the user’s click coordinates on the transparent overlay.
const clickX = event?.clientX;
const clickY = event?.clientY;
// Check if the click falls within the target element bounds
const isWithinTarget = !!clickX && !!clickY && clickX >= xOffset && clickX <= xOffset + targetWidth && clickY >= yOffset && clickY <= yOffset + targetHeight;
// Hide the tooltip
onDismissTooltip();
// If the click is within target bounds, trigger the children element's press callback
requestAnimationFrame(() => {
if (!isWithinTarget) {
return;
}
onHideTooltip();
onChildrenElementPress?.();
});
}; On native: const handleOverlayClick = (event?: GestureEvent) => {
// Captures the user’s click coordinates on the transparent overlay.
const pageX = event?.nativeEvent.pageX;
const pageY = event?.nativeEvent.pageY;
// Compares these coordinates against the position and dimensions of the target element that the tooltip references.
const isWithinTarget = !!pageX && !!pageY && pageX >= xOffset && pageX <= xOffset + targetWidth && pageY >= yOffset && pageY <= yOffset + targetHeight;
onDismissTooltip();();
requestAnimationFrame(() => {
if (!isWithinTarget) {
return;
}
// the tooltip should not be displayed again
onHideTooltip();
onChildrenElementPress?.();
});
};
const holeStyle = useMemo(
() => ({
position: styles.pFixed,
top: holeY,
left: holeX,
width: holeWidth,
height: holeHeight,
zIndex: 1500,
}),
[holeX, holeY, holeWidth, holeHeight, styles.pFixed],
);
return (
<View
onPointerDown={handlePointerDown}
style={styles.fullScreen}
>
<PressableWithoutFeedback
onPress={onPress}
style={[styles.flex1, styles.cursorDefault, overlay]}
accessibilityLabel={translate('common.close')}
role={CONST.ROLE.BUTTON}
/>
>
{/* "Hole" area with a hand cursor */}
<PressableWithoutFeedback
onPress={onPress}
style={holeStyle}
role={CONST.ROLE.BUTTON}
/>
</PressableWithoutFeedback>
</View>
);
{shouldUseOverlay && (
<TransparentOverlay
onPress={handleOverlayClick}
holeX={xOffset}
holeY={yOffset}
holeWidth={targetWidth}
holeHeight={targetHeight}
/>
)}
Test branch:main...rayane-djouah:z:Make-it-possible-to-click-the-product-training-tooltip-element Result:Screen.Recording.2024-12-14.at.4.56.17.PM.movScreen.Recording.2024-12-14.at.4.53.36.PM.movWhat alternative solutions did you explore? (Optional)On web, we can dispatch the mouse press event to the underlaying element, but we can't do this on native, so // If the click is within the target element, re-dispatch the event to the element
const targetElement = document.elementFromPoint(clickX, clickY) as HTMLElement | null;
if (targetElement) {
// Create a new MouseEvent and dispatch it to simulate a click
const simulatedClick = new MouseEvent('click', {bubbles: true, cancelable: true, clientX: clickX, clientY: clickY});
targetElement.dispatchEvent(simulatedClick);
} |
Updated the proposal with more details |
NOT OVERDUE DISCUSSING HERE https://expensify.slack.com/archives/C02NK2DQWUX/p1733780305744839 |
@puneetlath, @twisterdotcom, @ishpaul777 Uh oh! This issue is overdue by 2 days. Don't forget to update your issues! |
No proposal this is on hold for #54263 |
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
@puneetlath, @twisterdotcom, @ishpaul777 Uh oh! This issue is overdue by 2 days. Don't forget to update your issues! |
On hold |
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
not on hold anymore we are looking for proposals |
Proposal updated |
Part of the Migrate Existing Users to NewDot project
Main issue: https://github.com/Expensify/Expensify/issues/437980
Doc section: https://docs.google.com/document/d/1m8e1ASwG70t651qSO6OfsSvW18RFrcWkO897iUllDLs/edit?tab=t.0#heading=h.yh89nmhpipyt
Project:
Feature Description
Make it possible to click the element the product training tooltip is pointing to.
Ideal Expected Behaviour:
Manual tests scenario:
Note: None of the tooltips should be autodismissed after few seconds
We have 4 tooltips at this time see list here and other 4 will be added in #54064 this should be the expected behavior for all tooltips
Issue Owner
Current Issue Owner: @Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @ishpaul777The text was updated successfully, but these errors were encountered: