Skip to content

fix: prevent text fields from auto-focusing on screen load#3857

Merged
jamesarich merged 1 commit into
meshtastic:mainfrom
mdecourcy:fix/text-field-auto-focus
Nov 29, 2025
Merged

fix: prevent text fields from auto-focusing on screen load#3857
jamesarich merged 1 commit into
meshtastic:mainfrom
mdecourcy:fix/text-field-auto-focus

Conversation

@mdecourcy

Copy link
Copy Markdown
Contributor

Closes #3856

Fixes issue where TextFields in node list (filter) and node detail (notes)
would automatically steal focus and show keyboard when screens load.

Root causes identified:
1. AnimatedPane in ListDetailPaneScaffold gives focus to the first focusable
   element during pane animation/transition (standard Android navigation behavior)
2. Frequent recompositions in stickyHeader (due to scroll animations) can
   trigger TextField focus requests
3. Android's focus system automatically assigns focus to the first focusable
   element when entering a new screen

Comprehensive solution applied:
1. Clear focus after AnimatedPane composition (AdaptiveNodeListScreen)
2. Make parent containers (Box/Column) focusable so they receive initial focus
   instead of TextFields (NodeListScreen, NodeDetailList)

This multi-layer defense ensures TextFields cannot steal focus from multiple
sources while preserving normal user interaction.
@github-actions github-actions Bot added the bugfix PR tag label Nov 29, 2025
@jamesarich jamesarich added this pull request to the merge queue Nov 29, 2025
Merged via the queue into meshtastic:main with commit ccbdb7b Nov 29, 2025
5 checks passed
@codecov

codecov Bot commented Nov 29, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 0.53%. Comparing base (d83c83c) to head (0f9331b).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
.../geeksville/mesh/ui/node/AdaptiveNodeListScreen.kt 0.00% 4 Missing ⚠️
...g/meshtastic/feature/node/detail/NodeDetailList.kt 0.00% 1 Missing ⚠️
...org/meshtastic/feature/node/list/NodeListScreen.kt 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##            main   #3857      +/-   ##
========================================
- Coverage   0.53%   0.53%   -0.01%     
========================================
  Files        390     390              
  Lines      22846   22850       +4     
  Branches    2889    2889              
========================================
  Hits         122     122              
- Misses     22703   22707       +4     
  Partials      21      21              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

Labels

bugfix PR tag

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Filter and Notes text fields steal focus on view load

2 participants