UIApplication.keyboardWillChangeFrameNotification posted on iPhone with UIApplication.keyboardIsLocalUserInfoKey true when a background app has presented the keyboard
Originator: | javier.api | ||
Number: | rdar://48608694 | Date Originated: | 3/5/2019 |
Status: | Open | Resolved: | |
Product: | UIKit | Product Version: | 12.2 |
Classification: | Bug | Reproducible: | Always |
Summary: `UIApplication.keyboardIsLocalUserInfoKey ` is documented with: The key for an NSNumber object containing a Boolean that identifies whether the keyboard belongs to the current app. With multitasking on iPad, all visible apps are notified when the keyboard appears and disappears. The value of this key is true for the app that caused the keyboard to appear and false for any other apps. From this, one can draw 2 conclusions: - iPhone apps shouldn't receive keyboard related notifications when the keyboard is not visible in them. This is not 100% clear to me based on the documentation, and is not the focus of this radar, but could potentially be a separate one (this project and the specified repro steps also show this). - `UIApplication.keyboardIsLocalUserInfoKey` should never be `true` when the keyboard is not visible in the app that receives the notification. Steps: - Open attached Xcode project - Launch this app on the simulator - Make sure software keyboard is enabled - Background it - Open messages.app - Tap on a conversation - Tap on the message text view to open the keyboard - Use the task switcher to switch back Expected: Keyboard related notifications are not posted to our app because it hasn’t presented the keyboard. Actual: The assertion in `ViewController.keyboardFrameWillUpdate(_:)` hits, because the notification is posted, and with the `UIApplication.keyboardIsLocalUserInfoKey` key set to true. Notes: This causes UI glitches in a lot of apps that update their layout to avoid the keyboard by shifting UI elements. The Twitch app which I work on is a good example of this. Because those layout updates are also animated, switching from Twitch to another app where you’re writing text with the keyboard, and then switching back, can result in the UI shifting up and down briefly, which looks very buggy.
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!
Oh, that one exists in OpenRadar as well: https://openradar.appspot.com/46903640
The radar has been closed as a duplicate of rdar://46903640, which is still open.
This Twitter user sent me a good video that shows the kind of UI animation glitch that occurs as a consequence of this issue: https://twitter.com/drunknbass/status/1103099651249496064