A blank keyboard appear in safari view controller

A blank keyboard appear in safari view controller

Description:

While clicking a password enter field in a page inside a safari view controller, keyboard will appear. However, the keyboard is blank out.

The app is enterprise program app which is iPhone app but allow to install in iPad. The issue will only appear in iPadOS 26+ and it can be temporary fixed by changing the window size.

Expected result:

A keyboard with characters button should be appeared.

Actual:

A keyboard which is blank and no characters can be input.

P.S. : A feedback ticket also raise : FB21921438

Encountering a blank keyboard in a SafariViewController on iPadOS 26+ can be frustrating, especially for enterprise applications. Here are some potential causes and solutions to help you diagnose and fix the issue:

Potential Causes

Compatibility Issues with iPadOS 26+: Recent changes in iPadOS might affect how SafariViewController handles keyboard presentation, particularly for enterprise apps. View Controller Presentation Style: The way the SafariViewController is presented might interfere with its ability to properly display the keyboard. Conflicting Settings or Permissions: Enterprise settings or restrictions might inadvertently affect keyboard functionality within web views. Web Content or JavaScript Issues: Specific content or scripts on the webpage might interfere with keyboard initialization or rendering. Safe Area Insets or Layout Issues: Incorrect handling of safe area insets or layout constraints might cause the keyboard to appear blank or off-screen.

Solutions and Workarounds

Ensure Proper Presentation Style: Always present SafariViewController using a standard method like present(_:animated:completion:). Avoid custom transitions that might disrupt its lifecycle. Check Safe Area Insets: Ensure that your view controller's layout respects safe area insets. Adjust constraints if necessary to prevent the keyboard from being obscured or improperly rendered. Handle Keyboard Notifications: Register for keyboard notifications (UIKeyboardWillShowNotification, UIKeyboardWillHideNotification) to adjust your view's layout dynamically. This can help ensure the keyboard appears correctly. Test with Different Web Content: Isolate the issue by testing with different web pages to determine if the problem is specific to certain content or scripts. This can help identify if external factors are causing the issue. Review Enterprise Settings: Consult with your enterprise IT department to ensure there are no restrictions or policies affecting keyboard functionality within web views. Look for settings related to content blocking, security, or accessibility. Check for Known Issues or Updates: Investigate if there are any known issues with SafariViewController on iPadOS 26+ and check for updates to Apple's frameworks or your app that might address these issues. Temporary Workaround - Adjust Window Size: As you've noted, resizing the window can temporarily resolve the issue. This might suggest a layout or rendering problem that can be addressed by ensuring consistent layout behavior across different screen sizes. Custom Keyboard Handling: If feasible, consider implementing a custom keyboard or web view solution to bypass potential issues with SafariViewController. This approach requires more effort but can offer greater control over keyboard presentation. Debugging with Instruments: Use Xcode's Instruments to profile the app and identify any performance bottlenecks or rendering issues that might be causing the blank keyboard. Pay particular attention to the keyboard's lifecycle and view hierarchy updates.

Example Code Adjustments

Here's a basic example of how you might handle keyboard notifications to adjust your view's layout:

import UIKit import SafariServices

class MyViewController: UIViewController, SFSafariViewControllerDelegate {

override func viewDidLoad() {
    super.viewDidLoad()
    NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillShow(_:)), name: UIResponder.keyboardWillShowNotification, object: nil)
    NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillHide(_:)), name: UIResponder.keyboardWillHideNotification, object: nil)
}

@objc func keyboardWillShow(_ notification: Notification) {
    if let keyboardFrame = notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? CGRect {
        view.frame.origin.y = -keyboardFrame.height
    }
}

@objc func keyboardWillHide(_ notification: Notification) {
    view.frame.origin.y = 0
}

func presentSafariViewController() {
    let safariVC = SFSafariViewController(url: URL(string: "https://example.com")!)
    safariVC.delegate = self
    present(safariVC, animated: true, completion: nil)
}

}

By implementing these strategies, you should be able to diagnose and resolve the blank keyboard issue in your SafariViewController on iPadOS 26+. If the problem persists, consider reaching out to Apple Support for further assistance.

A blank keyboard appear in safari view controller
 
 
Q