feat: add hardware keyboard navigation from input fields - WPB-14697 - #5085
feat: add hardware keyboard navigation from input fields - WPB-14697#5085acv-w wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR improves hardware keyboard navigation in the app’s conversation UI by ensuring Tab can move focus out of text input fields (message composer and conversation search) and by making the conversation list focusable via the focus engine.
Changes:
- Enabled focus on the conversation list
UICollectionViewto allow keyboard focus on list content. - Intercepted Tab in the conversation search bar to resign first responder and trigger a focus update.
- Added
preferredFocusEnvironmentsoverrides for both the conversation list and the input bar to steer focus out of active text fields toward appropriate UI controls.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| wire-ios/Wire-iOS/Sources/UserInterface/ConversationList/ListContent/ConversationListContentController/ConversationListContentController.swift | Enables focus on the conversation list collection view for keyboard navigation. |
| wire-ios/Wire-iOS/Sources/UserInterface/ConversationList/Container/ConversationListViewController+UISearchBarDelegate.swift | Handles Tab key in the search bar to move focus out of the search field. |
| wire-ios/Wire-iOS/Sources/UserInterface/ConversationList/Container/ConversationListViewController.swift | Adds focus-environment preference to direct focus to the conversation list when leaving search. |
| wire-ios/Wire-iOS/Sources/UserInterface/Conversation/InputBar/ConversationInputBarViewController+UITextViewDelegate.swift | Updates Tab handling in the composer to trigger focus updates before leaving the text view. |
| wire-ios/Wire-iOS/Sources/UserInterface/Conversation/InputBar/ConversationInputBarViewController/ConversationInputBarViewController.swift | Adds focus-environment preference to route focus to send/auxiliary buttons when leaving the composer. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| func searchBar( | ||
| _ searchBar: UISearchBar, | ||
| shouldChangeTextIn range: NSRange, | ||
| replacementText text: String | ||
| ) -> Bool { | ||
| guard text == "\t" else { return true } | ||
|
|
||
| let focusEnvironment = navigationController ?? self | ||
| focusEnvironment.setNeedsFocusUpdate() | ||
| focusEnvironment.updateFocusIfNeeded() | ||
| searchBar.searchTextField.resignFirstResponder() | ||
| return false | ||
| } |
| override var preferredFocusEnvironments: [any UIFocusEnvironment] { | ||
| guard navigationItem.searchController?.searchBar.searchTextField.isFirstResponder == true else { | ||
| return super.preferredFocusEnvironments | ||
| } | ||
|
|
| if text == "\t" { | ||
| setNeedsFocusUpdate() | ||
| updateFocusIfNeeded() | ||
| textView.resignFirstResponder() | ||
| UIAccessibility.post( |
| override var preferredFocusEnvironments: [any UIFocusEnvironment] { | ||
| guard isViewLoaded, inputBar.textView.isFirstResponder else { | ||
| return super.preferredFocusEnvironments | ||
| } | ||
|
|
|
|
||
| collectionView.alwaysBounceVertical = true | ||
| collectionView.allowsFocus = true | ||
| collectionView.allowsSelection = true | ||
| collectionView.allowsMultipleSelection = false |
Test Results1 941 tests 1 914 ✅ 2m 56s ⏱️ Results for commit cdea14f. Summary: workflow run #30562635224 |
|
This PR is stale because it has been open 30 days with no activity. Please update it or close it in case is not relevant anymore. |
Issue
Moves focus out of the message composer and conversation search when Tab is pressed, while preserving VoiceOver behavior. Conversation list cells are now keyboard-focusable.
Checklist
[WPB-XXX].UI accessibility checklist
If your PR includes UI changes, please utilize this checklist: