Skip to content

[Due for payment 2026-05-26] Chat - Composer is refocused but not highlighted after deleting message via keyboard #90841

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: 9.3.75
Reproducible in staging?: Yes
Reproducible in production?: No
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #90516
Email or phone of affected tester (no customers): jsnodjosndjoisnjidoj@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Mac 26.2 / Chrome
App Component: Chat Report View

Action Performed:

  1. Go to staging.new.expensify.com
  2. Open any chat.
  3. Send a message.
  4. Press keyboard up arrow.
  5. Clear the composer and hit Enter twice.

Expected Result:

Composer will be refocused and highlighted.

Actual Result:

Composer is refocused but not highlighted after deleting message via keyboard.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7155296_1778865816161.7.mp4

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @hungvu193

Activity

  1. added
    DeployBlockerCashThis issue or pull request should block deployment
    BugSomething is broken. Auto assigns a BugZero manager.
    on May 15, 2026
  2. melvin-bot commented on May 15, 2026

    @melvin-bot

    @mountiny recently merged #90516, but they are OOO right now, so I'll auto-assign someone else.

  3. melvin-bot commented on May 15, 2026

    @melvin-bot

    Triggered auto assignment to @marcaaron (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

  4. melvin-bot commented on May 15, 2026

    @melvin-bot

    💬 A slack conversation has been started in #expensify-open-source

  5. github-actions commented on May 15, 2026

    @github-actions
    Contributor

    👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

    1. Identify the pull request that introduced this issue and revert it.
    2. Find someone who can quickly fix the issue.
    3. Fix the issue yourself.
  6. OSBotify commented on May 15, 2026

    @OSBotify
    Contributor

    Investigation Summary

    Classification: Frontend bug
    Causing PR: #90516 - "Allow editing messages in Composer on narrow screens V2" by @chrispader (High confidence)
    Related Issues: #64085, #90512, #90444, #90492, #90435, #90433, #90431, #90430

    Recommendation: REVERT

    PR #90516 introduced a regression in focusComposerWithDelay that skips calling input.focus() when the composer is already focused, relying instead on requestKeyboardForFocusedComposer — which is a NOOP on web — causing the composer to not visually highlight after a message delete-via-keyboard flow.

    Assigned: @chrispader (PR author), @mountiny and @hungvu193 (approving reviewers) from PR #90516
    Labels: DeployBlockerCash kept (frontend App regression). DeployBlocker not present, no change needed.

    Detailed Analysis

    Evidence

    Verification

    • Affected file: src/libs/focusComposerWithDelay/index.ts — this file was modified by PR Allow editing messages in Composer on narrow screens V2 #90516
    • PR Allow editing messages in Composer on narrow screens V2 #90516 modified focusComposerWithDelay to add a new branch: when the composer is already focused (getIsFocused() returns true), it calls requestKeyboardForFocusedComposer instead of input.focus()
    • requestKeyboardForFocusedComposer/index.ts (the web implementation) is defined as a NOOP (const NOOP = () => {})
    • Previously, the code always called textInput.focus() unconditionally, which triggers the browser's visual focus highlight

    Root Cause

    In the old code, focusComposerWithDelay always called textInput.focus() regardless of current focus state. In PR #90516's refactor, a new focusAndUpdateSelection inner function was introduced that short-circuits early when getIsFocused() is true — skipping input.focus() entirely and delegating to requestKeyboardForFocusedComposer. On web, requestKeyboardForFocusedComposer is a NOOP. This means that after a message is deleted via the edit+clear+Enter flow, when useEditComposerToggle calls onFocus() to re-highlight the composer, the focus call is silently dropped because the DOM element is already technically focused. The browser does not re-apply the visual highlight (CSS :focus / focus ring) unless focus() is called again.

    The exact flow:

    1. User presses up-arrow to enter edit mode (editingState = EDITING)
    2. User clears text and presses Enter — publishDraft with empty message triggers the delete confirmation modal
    3. User confirms deletion — deleteDraft() calls stopEditing() setting editingState = OFF
    4. useEditComposerToggle detects editing ended and calls onFocus?.() (line 94)
    5. handleEditFocus invokes focus(true, undefined, true) with forceKeyboardIfAlreadyFocused = true
    6. Inside focusComposerWithDelay, getIsFocused() returns true (composer DOM element was already active), so input.focus() is skipped
    7. requestKeyboardForFocusedComposer (NOOP on web) is called instead — no visual update occurs
    8. The composer appears refocused but not highlighted
  7. 8 remaining items

  8. melvin-bot commented on May 19, 2026

    @melvin-bot

    Reviewing label has been removed, please complete the "BugZero Checklist".

  9. changed the title [-]Chat - Composer is refocused but not highlighted after deleting message via keyboard[/-] [+][Due for payment 2026-05-26] Chat - Composer is refocused but not highlighted after deleting message via keyboard[/+] on May 19, 2026
  10. melvin-bot commented on May 19, 2026

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.77-3 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 2026-05-26. 🎊

    For reference, here are some details about the assignees on this issue:

    • @hungvu193 requires payment through NewDot Manual Requests
    • @chrispader does not require payment (Contractor)
  11. melvin-bot commented on May 19, 2026

    @melvin-bot

    @hungvu193 The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

  12. hungvu193 commented on May 25, 2026

    @hungvu193
    Contributor

    Regression from #90516. We can close

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.EngineeringWeeklyKSv2

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions