-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Open
Description
Describe the bug
The Done button (input accessory view) in the toolbar of UITextField returns an incorrect value for UITraitCollection.current.userInterfaceStyle. However, when tapping the default return button of the keyboard, the correct value is returned.
To Reproduce
Steps to reproduce the behavior:
- Just drop a
UITextFieldon the storyboard and make its delegate to self controller. - Confirm to delegate method - 'textFieldDidEndEditing' and put a print statement to print the 'UITraitCollection.current.userInterfaceStyle == .dark'.
- Change the device’s appearance (Light/Dark mode).
- Tap the
UITextFieldto bring up the keyboard. - Press the Done button in the toolbar.
- Observe the value of
UITraitCollection.current.userInterfaceStyle. - Now, tap the Return button on the keyboard instead.
- Compare the value of
UITraitCollection.current.userInterfaceStyle.
Expected behavior
UITraitCollection.current.userInterfaceStyleshould return the correct interface style (light or dark mode) when tapping the Done button, just as it does when tapping the default return button.
Screenshots
Versions
- Xcode: (16.2)
- Mac OS: (14.7)
- Simulator/Device: (Simulator)
- Simulator/Device Name: iPhone (15)
Copilot
Metadata
Metadata
Assignees
Labels
No labels