I’ve encountered an issue with the virtual keyboard on iOS when rotating the device.
Issue Description:
When the virtual keyboard is displayed on iOS and the device orientation is changed (portrait ↔ landscape), the keyboard fails to follow the new orientation and remains in its original position/orientation.
Reproduction:
Display the virtual keyboard on iOS
Rotate the device while the keyboard is visible
The keyboard does not reorient to match the new device orientation
Version Information:
Works correctly: v8.0.8
Broken: v8.0.10 and latest develop branch
I’ve attached a sample project that reproduces this issue.
Could you please investigate this regression? Let me know if you need any additional information.
I’ve got a physical device running iOS 18.7.1 here, so it would be helpful to know whether the issue is also present on that version, and/or any of the iOS simulators, before attempting to reproduce locally. Thanks in advance!
Updating the device’s iOS to 18.7.1 still caused issues.
The device is an iPhone 14.
I also checked using the Simulator, but regardless of the situation, the keyboard layout only appeared in Portrait mode, making it difficult to verify properly.
Thanks, I am able to reproduce the issue and I’ve bisected the problem to this commit:
I’ve spent some time investigating, and I can’t see any obvious cause for the faulty behaviour. However, while experimenting I did discover that initialising our UIWindow with an appropriate UIWindowScene (as opposed to the current approach, where we assign the UIWindowScene some time after initialising the window) seems to fix the problem.
I don’t have much confidence in this solution, since it’s relying on undocumented behaviour. Please could you try applying the above patch on the develop branch and check whether it fixes the issue for you? Thanks in advance!
I applied the patch above and did a quick test using my code from the other thread (Android and safe area insets). I did so because I noticed that the Bluetooth pairing dialogue is resized imporperly when the device is rotated, so I wondered if this is related. With the patch I can’t get the blueotooth dialogue to be be displayed at all. Tested on iOS 18.7.
This is the fix for the keyboard failing to follow the device orientation. This also addresses the regression where secondary windows would fail to display.
I also pushed a fix for the issue where the bluetooth MIDI pairing dialog didn’t behave well when rotating the device. This had a different underlying cause in the end.