iOS 18.4.1 Keyboard Extension Dark Mode Background Issue

Background Color Issue in Custom Keyboard Extension in Dark Mode for iOS 18.4.1

Issue Description

I'm developing a custom keyboard extension for iOS 18.4.1 and experiencing an issue with background colors when using Dark Mode. After a user makes a selection from a menu in the keyboard, the background color of a view unexpectedly changes to white instead of maintaining the dark theme color.

Steps to Reproduce

  1. Enable Dark Mode on the device
  2. Activate the custom keyboard in any text field
  3. Perform a specific interaction (selecting an item from a menu)
  4. After selection, the background of the view turns white instead of remaining dark

Technical Details

  • The issue appears to be related to UIScrollView's background color behavior
  • The problem doesn't occur on initial display of the menu, only after user interaction
  • I've attempted to set background colors explicitly on the view hierarchy, but the issue persists

Environment

  • iOS 18.4.1
  • Xcode 16.0
  • Custom keyboard extension

Questions

  1. Has anyone encountered similar issues with view background colors changing after user interactions in keyboard extensions on iOS 18.4.1?
  2. Is there a recommended approach to maintain dark background colors in keyboard extensions after user selections?
  3. Could this be related to a change in how UIScrollView handles background colors in recent iOS versions?

Thank you for any assistance or insights.

iOS 18.4.1 Keyboard Extension Dark Mode Background Issue
 
 
Q