Skip to content

[$250] Web - Distance - Unable to reorder waypoints using keyboard #83903

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

Action Performed:

  1. Go to staging.new.expensify.com
  2. Open FAB > Track distance > Map.
  3. Enter Start and Stop waypoint.
  4. Tab to a waypoint.
  5. Press space on the keyboard.
  6. Press down arrow on the keyboard.

Expected Result:

In Step 5, after pressing space on a waypoint, it will be picked up so that user can move it down with keyboard (according to #79793).

Actual Result:

In Step 5, after pressing space on a waypoint, waypoint editor opens.
User cannot reorder waypoints using keyboard.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7092083_1772466319793.12.mp4

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @abzokhattab
Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~022031094593402003287
  • Upwork Job ID: 2031094593402003287
  • Last Price Increase: 2026-03-09

Activity

  1. melvin-bot commented on Mar 2, 2026

    @melvin-bot

    You have been assigned to this deploy blocker because you recently merged this PR: #82500

  2. melvin-bot commented on Mar 2, 2026

    @melvin-bot

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

  3. github-actions commented on Mar 2, 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.
  4. OSBotify commented on Mar 2, 2026

    @OSBotify
    Contributor

    Investigation Summary

    Classification: Frontend bug
    Causing PR: #82500 - "Add keyboard navigation support for autocomplete result rows" by @MobileMage (High confidence)
    Related Issues: None directly linked, but PR #80261 appears to contain additional keyboard handling fixes

    Recommendation: REVERT

    PR #82500 should be reverted from staging. The PR added keyboard navigation support to google-places-autocomplete rows, which appears to have introduced a conflict with the waypoint reordering keyboard shortcuts implemented in PR #79793.

    Note: PR #80261 ("fix: resolve keyboard reordering edge cases in DraggableList") was merged shortly after #82500 and may contain relevant fixes. It should be included when re-landing #82500.

    Labels: Removing DeployBlockerCash - this issue does not block the App deploy as it was caught during regression testing and only affects staging.

    Detailed Analysis

    Evidence

    1. The issue explicitly links to PR Add keyboard navigation support for autocomplete result rows #82500 in the regression testing field
    2. The bug is reproducible on staging (v9.3.27-5) which includes PR Add keyboard navigation support for autocomplete result rows #82500
    3. The bug is NOT reproducible on production, which does not include PR Add keyboard navigation support for autocomplete result rows #82500
    4. PR Add keyboard navigation support for autocomplete result rows #82500 was merged on 2026-02-27 at 14:21:43Z and is included in the staging deploy checklist

    Verification

    PR #82500 changed files:

    • patches/react-native-google-places-autocomplete/details.md
    • patches/react-native-google-places-autocomplete/react-native-google-places-autocomplete+2.5.6+002+keyboard-navigation.patch

    The patch adds keyboard accessibility to autocomplete rows including:

    • tabIndex={0} to make rows focusable
    • accessibilityRole="button"
    • Space key handler with preventDefault()

    Waypoint reordering (from PR #79793):

    • Uses DraggableList component with @dnd-kit KeyboardSensor
    • Space key is configured to start/end drag operations
    • Waypoint items use MenuItem component with role="button"

    Root Cause

    While the exact interaction mechanism is complex, the evidence strongly points to PR #82500 introducing a conflict with keyboard event handling that prevents waypoint reordering via Space key. The timing of PR #80261 (merged 2 hours after #82500 on the same day) with fixes for "keyboard reordering edge cases" suggests the issue was identified and fixed, but #80261 is not yet on staging.

  5. added
    DeployBlockerCashThis issue or pull request should block deployment
    and removed on Mar 2, 2026
  6. 28 remaining items

  7. added
    ExternalAdded to denote the issue can be worked on by a contributor
    BugSomething is broken. Auto assigns a BugZero manager.
    and removed
    ReviewingHas a PR in review
    on Mar 9, 2026
  8. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Mar 9, 2026
  9. melvin-bot commented on Mar 9, 2026

    @melvin-bot

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

  10. changed the title [-]Web - Distance - Unable to reorder waypoints using keyboard[/-] [+][$250] Web - Distance - Unable to reorder waypoints using keyboard[/+] on Mar 9, 2026
  11. melvin-bot commented on Mar 9, 2026

    @melvin-bot
  12. melvin-bot commented on Mar 9, 2026

    @melvin-bot

    Triggered auto assignment to @garrettmknight (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

  13. MelvinBot commented on Mar 9, 2026

    @MelvinBot
    Contributor

    Proposal

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

    Keyboard reordering of waypoints in the distance request flow does not work. When a user Tabs to a waypoint and presses Space, the waypoint editor opens instead of initiating a drag-and-drop reorder. The expected behavior (from PR #79793) is that Space picks up the waypoint so arrow keys can move it.

    What is the root cause of that problem?

    The root cause is tabIndex={-1} on the SortableItem wrapper div at src/components/DraggableList/SortableItem.tsx:34-35. This was added by PR #79420 to fix a WCAG double-focus issue (two tab stops per waypoint: outer wrapper + inner MenuItem).

    However, tabIndex={-1} removes the wrapper from the tab order entirely. dnd-kit's useSortable hook returns attributes with tabIndex=0 by default specifically so the wrapper can receive focus and keyboard events — but the override defeats this design.

    The failure chain is:

    1. User presses Tab — focus skips the wrapper (tabIndex={-1}) and lands on the inner MenuItem's Pressable (tabIndex=0, role="button")
    2. User presses Space — React Native Web's PressResponder intercepts it, calls event.stopPropagation(), and treats it as a button press
    3. dnd-kit's onKeyDown listener on the wrapper never fires because (a) the event was stopped by stopPropagation and (b) the wrapper never had focus to begin with
    4. PressResponder triggers onPress, which navigates to the waypoint editor

    Additionally, even if the event somehow reached the wrapper, dnd-kit's KeyboardSensor activator explicitly checks event.target !== activatorNode and rejects events originating from child elements.

    PR #80261 (keyboard reordering edge case fixes) was merged but does not address tabIndex={-1} — it fixed Enter key conflicts, ghost drag state, and keyboard codes, but inherited the broken focus management.

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

    Remove the tabIndex={-1} override from the SortableItem wrapper so dnd-kit's default tabIndex=0 from attributes is applied, restoring keyboard reordering.

    To preserve the WCAG single-tab-stop requirement (the original reason for tabIndex={-1}), add an onFocus handler on the wrapper that sets nested interactive children (buttons, elements with positive tabIndex) to tabIndex={-1} when the wrapper receives focus. This ensures only one tab stop per item while keeping the wrapper focusable for dnd-kit's KeyboardSensor.

    Also extend the existing handleKeyDown capture handler to forward Enter presses to the first inner button, since the inner MenuItem is no longer directly tabbable.

    What alternative solutions did you explore? (Optional)

    1. Cherry-pick PR fix: resolve keyboard reordering edge cases in DraggableList #80261 only — Does not help because fix: resolve keyboard reordering edge cases in DraggableList #80261 does not address tabIndex={-1}.
    2. Revert PR fix: Keyboard Navigation: Track Distance: The listed start/stop points have two focus points #79420 — Would fix keyboard drag but reintroduce the WCAG double-focus issue.
    3. useEffect + useRef approach — Set children non-tabbable on mount. More complex than the onFocus handler approach since it requires extra hooks/refs and doesn't handle dynamic content as naturally.
    4. Dedicated drag-handle button — Add a separate focusable drag handle element. This would be a larger UX/design change and is unnecessary since the onFocus approach solves both requirements.

    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.

  14. rushatgabhane commented on Mar 12, 2026

    @rushatgabhane
    Member

    Hi, I'm reopening #79247 as it was originally fixed there

    So gonna close this one

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