Focus should not blur briefly after tapping on a suggested action #5097
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changelog Entry
Fixed
Description
After tapping on a suggested action, the focus is blurred briefly before sending to the send box.
This pull request resolves the issue by sending the focus to the send box, wait for focus send complete, then, send the card action and remove the suggested action.
Design
Today:
setTimeout(..., 0)
)There are 2 parts we need to modify:
However, iOS 17 does not support
navigator.virtualKeyboard
API. We have to use thereadonly
attribute trick to focus on the send box while preventing the keyboard to show up. This will keep the focus on the send box without showing the virtual keyboard.To ensure point 3 is awaitable, we are extending by following the
ExtendableEvent.waitUntil
pattern.Specific Changes
SuggestedAction.tsx
to move the focus before sending and unmounting suggested actionTextBox.tsx
to addwaitUntil()
to signal the completion of focus changetype-fest
as development dependencies tocomponent
packageCHANGELOG.md
Review Checklist
CSS styles reviewed (minimal rules, noz-index
)Documents reviewed (docs, samples, live demo)Internationalization reviewed (strings, unit formatting)package.json
andpackage-lock.json
reviewedSecurity reviewed (no data URIs, check for nonce leak)