[Android, Accessibility] Modals break when pressing ESC on physical keyboard
まだ誰も着手していません。
- 主要言語
- C++
- スター
- 127k
- フォーク
- 25.3k
- 平均マージ
- 1日 23時間
- マージ済み PR(30日)
- 4
説明
Description
When closing a Modal with ESC key from a Bluetooth keyboard on Android,
the modal closes natively but onRequestClose callback is not invoked.
This leaves React state out of sync.
Steps to reproduce
- Run the reproducer on Android device with Bluetooth keyboard connected
- Press "Open Modal" button
- Press hardware BACK button or use the BACK gesture -> "onRequestClose called!" alert appears ✅
- Press "Open Modal" again
- Press ESC key -> Modal closes but NO alert appears ❌
- Modal state is still 'true' in React but Modal is closed
- Press "Open Modal" again -> Nothing happens (state is already true)
BEWARE: after the state gets stuck you cannot tap on the screen anymore, you have to reach and activate the reset state button via keyboard.
EXPECTED: ESC should call onRequestClose (like back button does)
ACTUAL: Modal closes silently without calling any callbacks
React Native Version
0.84.1
Affected Platforms
Runtime - Android
Output of npx @react-native-community/cli info
System:
OS: macOS 26.4
CPU: (8) arm64 Apple M2
Memory: 116.42 MB / 16.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 24.14.1
path: /Users/XXX/.nvm/versions/node/v24.14.1/bin/node
Yarn:
version: 1.22.22
path: /opt/homebrew/bin/yarn
npm:
version: 11.11.0
path: /Users/XXX/.nvm/versions/node/v24.14.1/bin/npm
Watchman:
version: 2022.11.28.00
path: /opt/homebrew/bin/watchman
Managers:
CocoaPods:
version: 1.15.2
path: /Users/XXX/.rbenv/shims/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 25.2
- iOS 26.2
- macOS 26.2
- tvOS 26.2
- visionOS 26.2
- watchOS 26.2
Android SDK:
API Levels:
- "34"
- "35"
- "36"
Build Tools:
- 33.0.1
- 34.0.0
- 35.0.0
- 36.0.0
Android NDK: Not Found
IDEs:
Android Studio: 2025.2 AI-252.25557.131.2521.14344949
Xcode:
version: 26.2/17C52
path: /usr/bin/xcodebuild
Languages:
Java:
version: 17.0.16
path: /usr/bin/javac
Ruby:
version: 2.7.5
path: /Users/XXX/.rbenv/shims/ruby
npmPackages:
"@react-native-community/cli":
installed: 20.1.3
wanted: ^20.1.3
react:
installed: 19.2.3
wanted: 19.2.3
react-native:
installed: 0.84.1
wanted: 0.84.1
react-native-macos: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: true
iOS:
hermesEnabled: true
newArchEnabled: true
Stacktrace or Logs
-
MANDATORY Reproducer
https://snack.expo.dev/@andreamartinez/react-native-modal-esc-key-bug
Screenshots and Videos
In the video the first modal closing is operated via Back gesture. When you see the blue outline on the buttons I am using the keyboard.
https://github.com/user-attachments/assets/aff72723-bc86-4f40-8c6e-cdcd86bd125d
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
リンクされた Snack 再現コードと Android Modal の処理から始め、ハードウェアの戻る操作の経路と ESC キーの処理を比較します。ESC を押すと onRequestClose が呼び出され、React のモーダル状態が同期されたままになることを確認し、その後、Bluetooth キーボードを接続した Android デバイスでも同じ動作を確認します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- android, react-native
- 領域
- accessibility, mobile
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 静か
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 45/100