[PR #7035] [CLOSED] [WIP] Fix category select always choosing first item on touch devices #13949

Closed
opened 2026-04-10 22:08:19 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/actualbudget/actual/pull/7035
Author: @danielalanbates
Created: 2/20/2026
Status: Closed

Base: masterHead: fix/issue-6401-android-tablet-category-select


📝 Commits (2)

📊 Changes

2 files changed (+19 additions, -14 deletions)

View changed files

📝 packages/desktop-client/src/components/autocomplete/Autocomplete.tsx (+13 -14)
upcoming-release-notes/6401.md (+6 -0)

📄 Description

Fixes #6401

Summary

When tapping a category in the autocomplete dropdown on Android tablets (and potentially other touch devices), the first item was always selected regardless of which item was actually tapped. This was a regression that appeared around v25.12.0.

Root cause

When an item is clicked/tapped in the Downshift-based autocomplete, selectItem() triggers onInputValueChange with the selected item's name and a clickItem state change type. The handler was not filtering out clickItem events from its early-return list, so it proceeded to:

  1. Re-filter suggestions based on the selected item's name
  2. Reset highlightedIndex to 0 (first item)
  3. Call open() to reopen the dropdown
  4. Update value and isChanged state

These intermediate state changes caused race conditions with React's batched rendering on touch devices, where the event sequence (touchstart → touchend → mousemove → mousedown → mouseup → click) can trigger re-renders between Downshift's internal state management and the actual selection callback.

The onSelect handler (which fires later in Downshift's setState callback) already correctly manages all necessary state — selectedItem, highlightedIndex, isOpen, and the selection callback via setTimeout.

Fix

  • Add Downshift.stateChangeTypes.clickItem to the early-return filter list in onInputValueChange, so click/tap selection events are fully handled by onSelect
  • Remove the now-redundant clickItem guard checks that were only partially mitigating the issue (skipping fireUpdate but still allowing the problematic state changes)

Testing

  • All 374 existing unit tests pass
  • TypeScript type check passes
  • Linting passes (0 errors)

This PR was created with the assistance of Claude Opus 4.6 by Anthropic. Happy to make any adjustments! Reviewed and submitted by a human.


Bundle Stats

Bundle Files count Total bundle size % Changed
desktop-client 27 14.83 MB → 14.83 MB (+4.99 kB) +0.03%
loot-core 1 5.82 MB 0%
api 1 4.36 MB 0%
View detailed bundle stats

desktop-client

Total

Files count Total bundle size % Changed
27 14.83 MB → 14.83 MB (+4.99 kB) +0.03%
Changeset
File Δ Size
locale/ca.json 📈 +5.07 kB (+2.77%) 182.95 kB → 188.02 kB
locale/en.json 📈 +38 B (+0.02%) 168.59 kB → 168.63 kB
src/components/autocomplete/Autocomplete.tsx 📉 -124 B (-0.47%) 25.54 kB → 25.42 kB
View detailed bundle breakdown

Added
No assets were added

Removed
No assets were removed

Bigger

Asset File Size % Changed
static/js/ca.js 182.95 kB → 188.02 kB (+5.07 kB) +2.77%
static/js/en.js 168.59 kB → 168.63 kB (+38 B) +0.02%

Smaller

Asset File Size % Changed
static/js/index.js 9.52 MB → 9.52 MB (-124 B) -0.00%

Unchanged

Asset File Size % Changed
static/js/indexeddb-main-thread-worker-e59fee74.js 12.94 kB 0%
static/js/workbox-window.prod.es5.js 5.64 kB 0%
static/js/da.js 106.46 kB 0%
static/js/de.js 180.27 kB 0%
static/js/en-GB.js 7.18 kB 0%
static/js/es.js 173.67 kB 0%
static/js/fr.js 179.8 kB 0%
static/js/it.js 171.27 kB 0%
static/js/nb-NO.js 157.07 kB 0%
static/js/nl.js 106.47 kB 0%
static/js/pl.js 88.48 kB 0%
static/js/pt-BR.js 154.41 kB 0%
static/js/th.js 182.04 kB 0%
static/js/uk.js 214.89 kB 0%
static/js/resize-observer.js 18.37 kB 0%
static/js/BackgroundImage.js 120.54 kB 0%
static/js/ReportRouter.js 1.16 MB 0%
static/js/narrow.js 637.68 kB 0%
static/js/TransactionList.js 106.22 kB 0%
static/js/wide.js 164.15 kB 0%
static/js/AppliedFilters.js 9.71 kB 0%
static/js/usePayeeRuleCounts.js 10.04 kB 0%
static/js/useTransactionBatchActions.js 13.23 kB 0%
static/js/FormulaEditor.js 1.04 MB 0%

loot-core

Total

Files count Total bundle size % Changed
1 5.82 MB 0%
View detailed bundle breakdown

Added
No assets were added

Removed
No assets were removed

Bigger
No assets were bigger

Smaller
No assets were smaller

Unchanged

Asset File Size % Changed
kcab.worker.C2MZfWzQ.js 5.82 MB 0%

api

Total

Files count Total bundle size % Changed
1 4.36 MB 0%
View detailed bundle breakdown

Added
No assets were added

Removed
No assets were removed

Bigger
No assets were bigger

Smaller
No assets were smaller

Unchanged

Asset File Size % Changed
bundle.api.js 4.36 MB 0%

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/actualbudget/actual/pull/7035 **Author:** [@danielalanbates](https://github.com/danielalanbates) **Created:** 2/20/2026 **Status:** ❌ Closed **Base:** `master` ← **Head:** `fix/issue-6401-android-tablet-category-select` --- ### 📝 Commits (2) - [`9da3082`](https://github.com/actualbudget/actual/commit/9da308233eb47ae20ee75608369a4f8386fb66b3) Fix category select always choosing first item on touch devices (#6401) - [`cdb8f41`](https://github.com/actualbudget/actual/commit/cdb8f4172680310196e84081bba0d4e750ad0ba2) Add release note for #6401 ### 📊 Changes **2 files changed** (+19 additions, -14 deletions) <details> <summary>View changed files</summary> 📝 `packages/desktop-client/src/components/autocomplete/Autocomplete.tsx` (+13 -14) ➕ `upcoming-release-notes/6401.md` (+6 -0) </details> ### 📄 Description Fixes #6401 ## Summary When tapping a category in the autocomplete dropdown on Android tablets (and potentially other touch devices), the first item was always selected regardless of which item was actually tapped. This was a regression that appeared around v25.12.0. ### Root cause When an item is clicked/tapped in the Downshift-based autocomplete, `selectItem()` triggers `onInputValueChange` with the selected item's name and a `clickItem` state change type. The handler was not filtering out `clickItem` events from its early-return list, so it proceeded to: 1. Re-filter suggestions based on the selected item's name 2. Reset `highlightedIndex` to `0` (first item) 3. Call `open()` to reopen the dropdown 4. Update `value` and `isChanged` state These intermediate state changes caused race conditions with React's batched rendering on touch devices, where the event sequence (touchstart → touchend → mousemove → mousedown → mouseup → click) can trigger re-renders between Downshift's internal state management and the actual selection callback. The `onSelect` handler (which fires later in Downshift's setState callback) already correctly manages all necessary state — `selectedItem`, `highlightedIndex`, `isOpen`, and the selection callback via `setTimeout`. ### Fix - Add `Downshift.stateChangeTypes.clickItem` to the early-return filter list in `onInputValueChange`, so click/tap selection events are fully handled by `onSelect` - Remove the now-redundant `clickItem` guard checks that were only partially mitigating the issue (skipping `fireUpdate` but still allowing the problematic state changes) ### Testing - All 374 existing unit tests pass - TypeScript type check passes - Linting passes (0 errors) *This PR was created with the assistance of Claude Opus 4.6 by Anthropic. Happy to make any adjustments! Reviewed and submitted by a human.* <!--- actual-bot-sections ---> <hr /> <!--- bundlestats-action-comment key:combined start ---> ### Bundle Stats Bundle | Files count | Total bundle size | % Changed ------ | ----------- | ----------------- | --------- desktop-client | 27 | 14.83 MB → 14.83 MB (+4.99 kB) | +0.03% loot-core | 1 | 5.82 MB | 0% api | 1 | 4.36 MB | 0% <details> <summary>View detailed bundle stats</summary> #### desktop-client **Total** Files count | Total bundle size | % Changed ----------- | ----------------- | --------- 27 | 14.83 MB → 14.83 MB (+4.99 kB) | +0.03% <details> <summary>Changeset</summary> File | Δ | Size ---- | - | ---- `locale/ca.json` | 📈 +5.07 kB (+2.77%) | 182.95 kB → 188.02 kB `locale/en.json` | 📈 +38 B (+0.02%) | 168.59 kB → 168.63 kB `src/components/autocomplete/Autocomplete.tsx` | 📉 -124 B (-0.47%) | 25.54 kB → 25.42 kB </details> <details> <summary>View detailed bundle breakdown</summary> <div> **Added** No assets were added **Removed** No assets were removed **Bigger** Asset | File Size | % Changed ----- | --------- | --------- static/js/ca.js | 182.95 kB → 188.02 kB (+5.07 kB) | +2.77% static/js/en.js | 168.59 kB → 168.63 kB (+38 B) | +0.02% **Smaller** Asset | File Size | % Changed ----- | --------- | --------- static/js/index.js | 9.52 MB → 9.52 MB (-124 B) | -0.00% **Unchanged** Asset | File Size | % Changed ----- | --------- | --------- static/js/indexeddb-main-thread-worker-e59fee74.js | 12.94 kB | 0% static/js/workbox-window.prod.es5.js | 5.64 kB | 0% static/js/da.js | 106.46 kB | 0% static/js/de.js | 180.27 kB | 0% static/js/en-GB.js | 7.18 kB | 0% static/js/es.js | 173.67 kB | 0% static/js/fr.js | 179.8 kB | 0% static/js/it.js | 171.27 kB | 0% static/js/nb-NO.js | 157.07 kB | 0% static/js/nl.js | 106.47 kB | 0% static/js/pl.js | 88.48 kB | 0% static/js/pt-BR.js | 154.41 kB | 0% static/js/th.js | 182.04 kB | 0% static/js/uk.js | 214.89 kB | 0% static/js/resize-observer.js | 18.37 kB | 0% static/js/BackgroundImage.js | 120.54 kB | 0% static/js/ReportRouter.js | 1.16 MB | 0% static/js/narrow.js | 637.68 kB | 0% static/js/TransactionList.js | 106.22 kB | 0% static/js/wide.js | 164.15 kB | 0% static/js/AppliedFilters.js | 9.71 kB | 0% static/js/usePayeeRuleCounts.js | 10.04 kB | 0% static/js/useTransactionBatchActions.js | 13.23 kB | 0% static/js/FormulaEditor.js | 1.04 MB | 0% </div> </details> --- #### loot-core **Total** Files count | Total bundle size | % Changed ----------- | ----------------- | --------- 1 | 5.82 MB | 0% <details> <summary>View detailed bundle breakdown</summary> <div> **Added** No assets were added **Removed** No assets were removed **Bigger** No assets were bigger **Smaller** No assets were smaller **Unchanged** Asset | File Size | % Changed ----- | --------- | --------- kcab.worker.C2MZfWzQ.js | 5.82 MB | 0% </div> </details> --- #### api **Total** Files count | Total bundle size | % Changed ----------- | ----------------- | --------- 1 | 4.36 MB | 0% <details> <summary>View detailed bundle breakdown</summary> <div> **Added** No assets were added **Removed** No assets were removed **Bigger** No assets were bigger **Smaller** No assets were smaller **Unchanged** Asset | File Size | % Changed ----- | --------- | --------- bundle.api.js | 4.36 MB | 0% </div> </details> </details> <!--- bundlestats-action-comment key:combined end ---> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-10 22:08:19 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/actual#13949