Skip to content

[$250] Chat - Emoji picker is not displayed correctly in resized window #87824

Closed

Description

@lanitochka17

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: v9.3.59-0
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #87394
Email or phone of affected tester (no customers): testpayment935@gmail.com
Issue reported by: Applause Internal Team
Bug source: Pull Request QA execution
Device used: Windows 11 pro /Chrome
App Component: Chat Report View

Action Performed:

  1. Navigate to staging.new.expensify.com
  2. Open any chat → click emoji picker button
  3. On web, resize the browser while emoji picker is open using device tool bar
  4. Try this multiple times
  5. In resized view, click the emoji picker
  6. Notice it is not displayed
  7. Click device tool bar in order to see the web view
  8. Notice the emoji picker is already shown
  9. Click device tool bar in order to see the mobile view
  10. Notice the repositioned emoji picker is shown

Expected Result:

The emoji picker should repositions correctly

Actual Result:

  • In step 4, repositioned emoji picker is not constantly shown
  • in step 5-10, the emojis are not shown when clicking the emoji picker until resized again

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari

Screenshots/Videos

Bug7129170_1776120380452.bandicam_2026-04-14_01-31-13-516.mp4

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @abdulrahuman5196
Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~022043831658429963643
  • Upwork Job ID: 2043831658429963643
  • Last Price Increase: 2026-04-27

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Apr 13, 2026
  2. MelvinBot commented on Apr 13, 2026

    @MelvinBot
    Contributor

    Proposal

    Problem

    The emoji picker fails to display or reposition correctly when the browser window is resized across the mobile/desktop breakpoint (800px), particularly when toggling Chrome DevTools device toolbar.

    Solution

    The root cause is a stale closure in the Dimensions.addEventListener('change') handler at src/components/EmojiPicker/EmojiPicker.tsx:209-236.

    When a resize crosses the 800px breakpoint, the Dimensions change event fires before React re-renders with the updated shouldUseNarrowLayout value. The handler captures the stale pre-resize value:

    • Desktop → mobile: shouldUseNarrowLayout is still false in the closure. If the anchor ref is null (which happens because EmojiPickerButton unmounts during layout shift and nulls the ref via cleanup), the condition isEmojiPickerVisible && !shouldUseNarrowLayout is true → hideEmojiPicker() is called, making the picker disappear.
    • Mobile → desktop: shouldUseNarrowLayout is still true in the closure → !shouldUseNarrowLayout is false → the handler neither hides nor repositions the picker, leaving it stuck with stale positioning.

    Additionally, the Popover component switches between entirely different rendering paths at the breakpoint (PopoverWithoutOverlay portal on wide screens vs BOTTOM_DOCKED Modal on narrow screens), causing destructive unmount/remount transitions.

    Note: This is a pre-existing issue, not a regression from PR #87394 (which only wrapped the picker content in a React <Activity> component).

    The fix should update the Dimensions change handler to use a ref for shouldUseNarrowLayout so the callback always reads the current value rather than a stale closure capture. Specifically:

    1. In EmojiPicker.tsx, add a ref that tracks shouldUseNarrowLayout:
      const shouldUseNarrowLayoutRef = useRef(shouldUseNarrowLayout);
      shouldUseNarrowLayoutRef.current = shouldUseNarrowLayout;
    2. In the Dimensions.addEventListener('change') callback (line 214), read from shouldUseNarrowLayoutRef.current instead of shouldUseNarrowLayout.
    3. Similarly, track isEmojiPickerVisible in a ref and read from it in the callback, so the hide check uses current state.
    4. Remove isEmojiPickerVisible and shouldUseNarrowLayout from the effect's dependency array (since they're now read from refs), which also prevents the listener from being torn down and recreated on every visibility/layout change.

    This ensures the handler always evaluates the current layout mode when a resize occurs, regardless of React's render timing.

    Investigation details

    Key files:

    • src/components/EmojiPicker/EmojiPicker.tsx:209-236 — Dimension change handler with stale closure
    • src/components/EmojiPicker/EmojiPicker.tsx:148-155 — onModalHide nulls anchor ref
    • src/components/EmojiPicker/EmojiPickerButton.tsx:74 — Cleanup effect nulls anchor ref on unmount
    • src/components/Popover/index.tsx:78-124 — Rendering path switch at breakpoint
    • src/components/PopoverWithMeasuredContent/PopoverWithMeasuredContentBase.tsx:74-86 — shouldSkipRemeasurement prevents re-measuring after resize

    Data flow during bug:

    1. User opens emoji picker on desktop (>800px). Popover renders as PopoverWithoutOverlay.
    2. User resizes below 800px. Dimensions change fires with stale shouldUseNarrowLayout=false.
    3. Layout shift causes EmojiPickerButton to remount → cleanup nulls emojiPopoverAnchorRef.
    4. Handler finds null anchor + stale values → calls hideEmojiPicker().
    5. onModalHide callback nulls anchor ref again.
    6. React re-renders with shouldUseNarrowLayout=true, but picker is already hidden.
    7. Popover rendering switches from portal to BOTTOM_DOCKED Modal (destructive transition).
    8. User clicks emoji button again → calculateAnchorPosition may get {0,0,0,0} from the recently-nulled ref.

    Alternative explanations considered:

    • PR decompose-composer 2: Activity for EmojiPicker and PopoverMenu #87394's <Activity> wrapper — Ruled out. The Activity component only controls rendering priority; it doesn't affect the Dimensions listener or anchor ref lifecycle.
    • shouldSkipRemeasurement=true on the EmojiPicker's PopoverWithMeasuredContent — This is a contributing factor (prevents re-measuring after hide/show cycle) but is secondary to the stale closure being the trigger.

    Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, @MelvinBot <your feedback> to refine this analysis, or explain why you are rejecting Melvin's proposal.

  3. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Apr 13, 2026
  4. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Apr 13, 2026
  5. melvin-bot commented on Apr 13, 2026

    @melvin-bot

    Triggered auto assignment to Contributor-plus team member for initial proposal review - @abdulrahuman5196 (External)

  6. changed the title [-]Chat - Emoji picker is not displayed correctly in resized window[/-] [+][$250] Chat - Emoji picker is not displayed correctly in resized window[/+] on Apr 13, 2026
  7. melvin-bot commented on Apr 13, 2026

    @melvin-bot
  8. trasnake87 commented on Apr 13, 2026

    @trasnake87
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    When the browser window is resized (for example, by toggling Chrome's device toolbar) while the emoji picker was previously opened, reopening the picker renders it at the wrong position — or not at all — until the window is resized again.

    What is the root cause of that problem?

    The root cause is in PopoverWithMeasuredContentBase, which caches popover size/position state across open/close cycles. The React.memo comparator at https://github.com/Expensify/App/blob/main/src/components/PopoverWithMeasuredContent/PopoverWithMeasuredContentBase.tsx#L232-L237 short-circuits and returns true (no re-render) whenever isVisible is false, so while the picker is closed, any window resize is never propagated into this component — windowWidth/windowHeight and usePrevious(prevWindowDimensions) stay frozen at pre-resize values. When the picker is reopened, the hasWindowSizeChanged guard at https://github.com/Expensify/App/blob/main/src/components/PopoverWithMeasuredContent/PopoverWithMeasuredContentBase.tsx#L74-L86 compares the new anchor position against stale dimensions, so it takes the "no remeasurement needed" path and renders the Popover using stale popoverWidth/popoverHeight and stale shift calculations.

    What changes do you think we should make in order to solve the problem?

    Allow the memoized component to re-render when window dimensions change even while invisible, so usePrevious(prevWindowDimensions) and the shift calculations stay fresh:

    // src/components/PopoverWithMeasuredContent/PopoverWithMeasuredContentBase.tsx
    export default React.memo(PopoverWithMeasuredContentBase, (prevProps, nextProps) => {
        if (prevProps.isVisible === nextProps.isVisible && nextProps.isVisible === false) {
            // Still re-render on window size changes so cached measurements don't go stale while hidden
            if (prevProps.anchorPosition?.horizontal !== nextProps.anchorPosition?.horizontal
                || prevProps.anchorPosition?.vertical !== nextProps.anchorPosition?.vertical) {
                return false;
            }
            return true;
        }
        return circularDeepEqual(prevProps, nextProps);
    });

    Additionally, reset isContentMeasured when windowWidth/windowHeight change via a useEffect, so a reopen after resize forces a fresh onLayout measurement instead of reusing cached popoverHeight/popoverWidth.

  9. trasnake87 commented on Apr 13, 2026

    @trasnake87
    Contributor

    Contributor details
    Your Expensify account email: trasnake87@gmail.com
    Upwork Profile Link: https://www.upwork.com/freelancers/~010f770315ab181656

  10. melvin-bot commented on Apr 13, 2026

    @melvin-bot

    ✅ Contributor details stored successfully. Thank you for contributing to Expensify!

  11. melvin-bot commented on Apr 14, 2026

    @melvin-bot

    📣 @yw13931835525-cyber! 📣
    Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
    Please follow these steps:

    1. Make sure you've read and understood the contributing guidelines.
    2. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
    3. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
    4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
      Screen Shot 2022-11-16 at 4 42 54 PM
      Format:
    Contributor details
    Your Expensify account email: <REPLACE EMAIL HERE>
    Upwork Profile Link: <REPLACE LINK HERE>
    
  12. twilight2294 commented on Apr 14, 2026

    @twilight2294
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    When the browser window is resized across the mobile/desktop breakpoint while the emoji picker is open (or was recently open), the picker renders at the wrong position or disappears entirely.

    What is the root cause of that problem?

    The Dimensions.addEventListener('change') callback in EmojiPicker captures shouldUseNarrowLayout via closure. When a resize crosses the 800px breakpoint, the event fires before React re-renders with the updated value. The callback reads the stale pre-resize shouldUseNarrowLayout, so it either incorrectly hides the picker (desktop→mobile) or fails to reposition it (mobile→desktop), while the underlying Popover switches between entirely different rendering paths (positioned popover vs. BOTTOM_DOCKED modal).

    What changes do you think we should make in order to solve the problem?

    In EmojiPicker, use the event argument's window dimensions to compute the current layout instead of relying on the stale closure:

    const emojiPopoverDimensionListener = Dimensions.addEventListener('change', ({window}) => {
        const isNowNarrowLayout = window.width <= variables.mobileResponsiveWidthBreakpoint;
    
        // When crossing the breakpoint, the popover rendering mode switches entirely —
        // hide and let the user reopen in the correct mode.
        if (isEmojiPickerVisible && isNowNarrowLayout !== shouldUseNarrowLayout) {
            hideEmojiPicker();
            return;
        }
    
        const emojiPopoverAnchor = getEmojiPopoverAnchor();
        if (!emojiPopoverAnchor?.current) {
            if (isEmojiPickerVisible && !isNowNarrowLayout) {
                hideEmojiPicker();
            }
            return;
        }
        calculateAnchorPosition(emojiPopoverAnchor?.current, emojiPopoverAnchorOrigin).then((value) => {
            setEmojiPopoverAnchorPosition({horizontal: value.horizontal, vertical: value.vertical});
            emojiAnchorDimension.current = {width: value.width, height: value.height};
        });
    });

    This requires importing variables from @styles/variables.

    What alternative solutions did you explore? (Optional)

    MelvinBot's proposal uses refs to track shouldUseNarrowLayout so the callback reads "current" values. This still has a race: the ref is updated during React's render phase, but the Dimensions event fires before that render, so the ref can still hold the pre-resize value at callback time. Using the event's own window.width is race-free because the dimensions come directly from the event payload, not from React state or refs. It also explicitly detects breakpoint crossings (isNowNarrowLayout !== shouldUseNarrowLayout) and always closes the picker when the rendering mode switches, which neither existing proposal handles.

    trasnake87's proposal fixes PopoverWithMeasuredContentBase's memo comparator to allow re-renders while invisible. This addresses a secondary symptom (stale cached measurements on reopen) but doesn't fix the primary cause: the dimension listener making wrong decisions with stale layout data during the resize itself.

  13. 8 remaining items

  14. melvin-bot commented on Apr 17, 2026

    @melvin-bot

    @abdulrahuman5196 Whoops! This issue is 2 days overdue. Let's get this updated quick!

  15. melvin-bot commented on Apr 20, 2026

    @melvin-bot

    📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

  16. melvin-bot commented on Apr 21, 2026

    @melvin-bot

    @abdulrahuman5196 Still overdue 6 days?! Let's take care of this!

  17. twilight2294 commented on Apr 23, 2026

    @twilight2294
    Contributor

    @abdulrahuman5196 can you please check my proposal here , thanks !

  18. emkhalid commented on Apr 23, 2026

    @emkhalid
    Contributor

    Proposal

    What is the root cause of that problem?

    EmojiPicker and Popover currently read from two different sources of truth during a resize, and that is what produces the bug.

    src/components/Popover/index.tsx selects the picker's presentation mode from committed React state (shouldUseNarrowLayout / isSmallScreenWidth). On a wide screen it renders an anchored PopoverWithoutOverlay; on a narrow screen it renders a BOTTOM_DOCKED modal that ignores anchorPosition entirely.

    if (!fullscreen && !shouldUseNarrowLayout) {
    return createPortal(
    <Modal
    // eslint-disable-next-line react/jsx-props-no-spreading
    {...props}
    onClose={onCloseWithPopoverContext}
    type={CONST.MODAL.MODAL_TYPE.POPOVER}
    popoverAnchorPosition={anchorPosition}
    animationInTiming={disableAnimation ? DISABLED_ANIMATION_DURATION : animationInTiming}
    animationOutTiming={disableAnimation ? DISABLED_ANIMATION_DURATION : animationOutTiming}
    onLayout={onLayout}
    animationIn={animationIn}
    animationOut={animationOut}
    />,
    document.body,
    );
    }
    if (withoutOverlay && !shouldUseNarrowLayout) {
    return createPortal(
    <PopoverWithoutOverlay
    // eslint-disable-next-line react/jsx-props-no-spreading
    {...props}
    withoutOverlayRef={withoutOverlayRef}
    animationIn={animationIn}
    animationOut={animationOut}
    />,
    document.body,
    );
    }
    return (
    <Modal
    // eslint-disable-next-line react/jsx-props-no-spreading
    {...props}
    onClose={onCloseWithPopoverContext}
    shouldHandleNavigationBack={props.shouldHandleNavigationBack}
    type={isSmallScreenWidth ? CONST.MODAL.MODAL_TYPE.BOTTOM_DOCKED : CONST.MODAL.MODAL_TYPE.POPOVER}
    popoverAnchorPosition={isSmallScreenWidth ? undefined : anchorPosition}
    fullscreen={shouldUseNarrowLayout ? true : fullscreen}
    animationInTiming={disableAnimation && !shouldUseNarrowLayout ? DISABLED_ANIMATION_DURATION : animationInTiming}
    animationOutTiming={disableAnimation && !shouldUseNarrowLayout ? DISABLED_ANIMATION_DURATION : animationOutTiming}
    onLayout={onLayout}
    animationIn={animationIn}
    animationOut={animationOut}
    />

    src/components/EmojiPicker/EmojiPicker.tsx, however, decides whether to keep the picker open and where to anchor it from a raw Dimensions.addEventListener('change') callback. The change event fires on the native resize tick, before React commits the re-render that flips shouldUseNarrowLayout and before the composer subtree finishes its remount. Inside that callback, three things can be transiently wrong at once:

    • shouldUseNarrowLayout is still the pre-resize value (closure capture)
    • emojiPopoverAnchorRef.current is null because EmojiPickerButton's cleanup ran during the layout shift
    • the picker's presentation mode has not yet switched

    useEffect(() => {
    const emojiPopoverDimensionListener = Dimensions.addEventListener('change', () => {
    const emojiPopoverAnchor = getEmojiPopoverAnchor();
    if (!emojiPopoverAnchor?.current) {
    // In small screen width, the window size change might be due to keyboard open/hide, we should avoid hide EmojiPicker in those cases
    if (isEmojiPickerVisible && !shouldUseNarrowLayout) {
    hideEmojiPicker();
    }
    return;
    }
    calculateAnchorPosition(emojiPopoverAnchor?.current, emojiPopoverAnchorOrigin).then((value) => {
    setEmojiPopoverAnchorPosition({
    horizontal: value.horizontal,
    vertical: value.vertical,
    });
    emojiAnchorDimension.current = {
    width: value.width,
    height: value.height,
    };
    });
    });
    return () => {
    if (!emojiPopoverDimensionListener) {
    return;
    }
    emojiPopoverDimensionListener.remove();
    };
    }, [isEmojiPickerVisible, shouldUseNarrowLayout, emojiPopoverAnchorOrigin, getEmojiPopoverAnchor, hideEmojiPicker]);

    So on a desktop→mobile resize, the isEmojiPickerVisible && !shouldUseNarrowLayout branch sees the stale false, finds a null anchor, and calls hideEmojiPicker() — even though Popover is about to switch to bottom-docked where no anchor is needed. On mobile→desktop, the stale true skips the hide path but the anchor is still mid-remount, so the picker reopens with a stale anchor position. The fundamental mismatch is that EmojiPicker's decision runs before the committed state that Popover reads, so the two components can never agree during the transition.

    What changes do you think we should make in order to solve the problem?

    Make EmojiPicker react to the same committed responsive state that Popover already reads, instead of subscribing to raw Dimensions events.

    Concretely, drop the Dimensions.addEventListener('change') subscription and replace it with a useEffect whose dependency array contains the committed isSmallScreenWidth + windowWidth + windowHeight. React guarantees this effect runs after commit, so it fires exactly once the responsive tree (composer, anchor, Popover's presentation-mode switch) has settled. Then:

    • On small screens, do nothing — Popover is rendering the picker as bottom-docked and ignores anchorPosition, so the picker stays open correctly through mobile resizing and soft-keyboard toggles without any imperative action.
    • On wide screens, wait one animation frame (lets the composer's remount flush its layout) and then measure the current anchor to reposition. If the anchor is genuinely gone on a wide screen, hide — an anchored popover with no anchor has no safe position.

    The diff against src/components/EmojiPicker/EmojiPicker.tsx:

    useEffect(() => {
    const emojiPopoverDimensionListener = Dimensions.addEventListener('change', () => {
    const emojiPopoverAnchor = getEmojiPopoverAnchor();
    if (!emojiPopoverAnchor?.current) {
    // In small screen width, the window size change might be due to keyboard open/hide, we should avoid hide EmojiPicker in those cases
    if (isEmojiPickerVisible && !shouldUseNarrowLayout) {
    hideEmojiPicker();
    }
    return;
    }
    calculateAnchorPosition(emojiPopoverAnchor?.current, emojiPopoverAnchorOrigin).then((value) => {
    setEmojiPopoverAnchorPosition({
    horizontal: value.horizontal,
    vertical: value.vertical,
    });
    emojiAnchorDimension.current = {
    width: value.width,
    height: value.height,
    };
    });
    });
    return () => {
    if (!emojiPopoverDimensionListener) {
    return;
    }
    emojiPopoverDimensionListener.remove();
    };
    }, [isEmojiPickerVisible, shouldUseNarrowLayout, emojiPopoverAnchorOrigin, getEmojiPopoverAnchor, hideEmojiPicker]);

    -import {Dimensions, View} from 'react-native';
    +import {View} from 'react-native';
    @@
    -    const {windowHeight} = useWindowDimensions();
    -    const {shouldUseNarrowLayout} = useResponsiveLayout();
    +    const {windowWidth, windowHeight} = useWindowDimensions();
    +    const {isSmallScreenWidth} = useResponsiveLayout();
    @@
    -    useEffect(() => {
    -        const emojiPopoverDimensionListener = Dimensions.addEventListener('change', () => {
    -            const emojiPopoverAnchor = getEmojiPopoverAnchor();
    -            if (!emojiPopoverAnchor?.current) {
    -                // In small screen width, the window size change might be due to keyboard open/hide, we should avoid hide EmojiPicker in those cases
    -                if (isEmojiPickerVisible && !shouldUseNarrowLayout) {
    -                    hideEmojiPicker();
    -                }
    -                return;
    -            }
    -            calculateAnchorPosition(emojiPopoverAnchor?.current, emojiPopoverAnchorOrigin).then((value) => {
    -                setEmojiPopoverAnchorPosition({
    -                    horizontal: value.horizontal,
    -                    vertical: value.vertical,
    -                });
    -                emojiAnchorDimension.current = {
    -                    width: value.width,
    -                    height: value.height,
    -                };
    -            });
    -        });
    -        return () => {
    -            if (!emojiPopoverDimensionListener) {
    -                return;
    -            }
    -            emojiPopoverDimensionListener.remove();
    -        };
    -    }, [isEmojiPickerVisible, shouldUseNarrowLayout, emojiPopoverAnchorOrigin, getEmojiPopoverAnchor, hideEmojiPicker]);
    +    useEffect(() => {
    +        // Bottom-docked mode ignores anchorPosition — no work to do on small screens
    +        // (this also makes soft-keyboard-driven resize events on mobile a no-op).
    +        if (!isEmojiPickerVisible || isSmallScreenWidth) {
    +            return;
    +        }
    +
    +        let isCancelled = false;
    +        // Wait one frame so the composer's responsive remount has committed its layout
    +        // before we measure the anchor.
    +        const animationFrame = requestAnimationFrame(() => {
    +            const emojiPopoverAnchor = getEmojiPopoverAnchor();
    +            if (!emojiPopoverAnchor?.current) {
    +                // On a wide screen with no anchor, there is no safe position — hide.
    +                hideEmojiPicker();
    +                return;
    +            }
    +            calculateAnchorPosition(emojiPopoverAnchor.current, emojiPopoverAnchorOrigin).then((value) => {
    +                if (isCancelled) {
    +                    return;
    +                }
    +                setEmojiPopoverAnchorPosition({
    +                    horizontal: value.horizontal,
    +                    vertical: value.vertical,
    +                });
    +                emojiAnchorDimension.current = {
    +                    width: value.width,
    +                    height: value.height,
    +                };
    +            });
    +        });
    +
    +        return () => {
    +            isCancelled = true;
    +            cancelAnimationFrame(animationFrame);
    +        };
    +    }, [isEmojiPickerVisible, isSmallScreenWidth, windowWidth, windowHeight, emojiPopoverAnchorOrigin, getEmojiPopoverAnchor, hideEmojiPicker]);

    Why this fixes it:

    • The effect runs after commit, so isSmallScreenWidth, the composer's anchor ref, and Popover's presentation-mode switch are all in their post-resize states when we evaluate. There is no transient window left to act on.
    • The small-screen early return eliminates the hideEmojiPicker() mis-trigger on desktop→mobile (bottom-docked mode needs no anchor) and also sidesteps soft-keyboard resize events on mobile that previously required a defensive shouldUseNarrowLayout check inside the listener.
    • The wide-screen path is race-free: by the time requestAnimationFrame fires, the composer has laid out its remounted subtree, so getEmojiPopoverAnchor() returns the new anchor. If it truly doesn't (e.g. the anchor was conditionally removed by a parent), hiding is the right call because an anchored popover cannot be rendered without one.
    • windowWidth/windowHeight in the deps means the effect re-runs on every committed dimension change, so resizing within wide-mode (pane changes, window drags) still repositions cleanly.
    • Cleanup cancels an in-flight frame and drops any late calculateAnchorPosition resolution, preventing out-of-order state writes during rapid resizing.

    What alternative solutions did you explore? (Optional)

    • Tracking shouldUseNarrowLayout and isEmojiPickerVisible in refs inside the existing Dimensions listener (MelvinBot's proposal). The ref is assigned during render; the Dimensions event fires on the native resize tick, which can precede React's render for that resize. So the ref still reads the pre-resize value at callback time. It narrows the race but does not close it, and it keeps EmojiPicker's logic out of sync with Popover's committed-state presentation choice.

    • Reading event.window.width from the Dimensions payload to compute the breakpoint race-free (twilight2294's proposal). Race-free for reading width, but the callback still runs before commit. The anchor ref is still transiently null during the composer's remount, and Popover has not yet switched presentation modes. The listener decides against transient state in the middle of the transition; my effect decides against the committed state after the transition.

    • Unblocking the React.memo comparator on PopoverWithMeasuredContentBase while invisible, plus resetting isContentMeasured on resize (trasnake87's proposal). This fixes a different, secondary issue (stale cached measurements on reopen). It does nothing about the primary cause: EmojiPicker's listener hiding or mispositioning the picker during the resize itself.

    • Introducing a live EmojiPopoverAnchorGetter, a popoverKey session identity on PopoverProvider, and post-commit reconciliation (nabi-ebrahimi's proposal). Correct in spirit, but the scope is much larger than the bug requires: it changes the shared showEmojiPicker API, updates all four call sites (EmojiPickerButton, EmojiPickerButtonDropdown, AddReactionBubble, MiniQuickEmojiReactions), and adds logic to PopoverProvider. The popoverKey / session-identity change targets a separate desktop-remount-close scenario that is not actually required to fix [$250] Chat - Emoji picker is not displayed correctly in resized window #87824's reported repro — the repro is "picker disappears / mispositions across a resize", and aligning EmojiPicker with Popover's committed state is sufficient for that.

    • Adding a global orientation/resize debounce outside EmojiPicker. Rejected: it shifts the bug's timing without fixing the source-of-truth mismatch, and debounces hurt perceived responsiveness on other flows that share those dimensions.

    Demo

    Screencast.From.2026-04-23.19-43-58.mp4
  19. github-actions commented on Apr 23, 2026

    @github-actions
    Contributor

    ⚠️ @emkhalid Your proposal is a duplicate of an already existing proposal and has been automatically withdrawn to prevent spam. Please review the existing proposals before submitting a new one.

  20. nabi-ebrahimi commented on Apr 23, 2026

    @nabi-ebrahimi

    My proposal fix demo:

    REC-20260423161942-compressed.mov
  21. melvin-bot commented on Apr 23, 2026

    @melvin-bot

    @abdulrahuman5196 8 days overdue is a lot. Should this be a Weekly issue? If so, feel free to change it!

  22. twilight2294 commented on Apr 24, 2026

    @twilight2294
    Contributor

    @abdulrahuman5196 can you please review my proposal #87824 (comment)

  23. abdulrahuman5196 commented on Apr 26, 2026

    @abdulrahuman5196
    Contributor

    I am sure if this is even an real issue. Seems like a very rare testing case in resize flow. I will ask about this in the slack channel - https://expensify.slack.com/archives/C02NK2DQWUX/p1777187683284119

  24. melvin-bot commented on Apr 27, 2026

    @melvin-bot

    📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

  25. mallenexpensify commented on Apr 27, 2026

    @mallenexpensify
    Contributor

    Upon further review and discussing with @abdulrahuman5196 , we're going to close this due to not having a confirmed RCA and, with it being such a tiny bug, we don't want to mess things up elsewhere. Thanks for helping here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributorHelp WantedApply this label when an issue is open to proposals by contributors

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions