AshleyScirra opened a new issue, #1397:
URL: https://github.com/apache/cordova-ios/issues/1397

   # Bug Report
   
   The Gamepad API does not work in WKWebView. This affects any content 
published to iOS with Cordova that uses gamepad input (such as games, as used 
by [Construct](https://www.construct.net)).
   
   According to Apple the problem may be that WKWebView needs to be the 
firstResponder. I'm filing this issue as cordova-ios may need to configure the 
WKWebView accordingly.
   
   ## Problem
   
   Repro Xcode project made using Construct: [Gamepad control 
example.ios.project.zip](https://github.com/apache/cordova-ios/files/14296256/Gamepad.control.example.ios.project.zip)
   
   Steps to reproduce:
   
   1. Connect a gamepad to an iOS device (in my case I used bluetooth to pair 
the controller to the device)
   2. Launch the Xcode project on the iOS device
   3. Press some gamepad buttons
   
   ### What is expected to happen?
   
   The app should detect the gamepad upon first pressing a button and allow 
controlling the sprite with gamepad input. This is how it works in the Safari 
browser.
   
   ### What does actually happen?
   
   No gamepad input is ever detected.
   
   ## Information
   Originally I assumed this was a bug in WKWebView and filed it with Apple 
here: https://bugs.webkit.org/show_bug.cgi?id=269292
   
   They responded:
   
   > To expose Gamepad support, your WKWebView needs to be the firstResponder.
   > 
   > Safari - correctly for Apple platforms - keeps focused WKWebViews as the 
firstResponder.
   > 
   > Many apps neglect to do this, and once we let a developer know and they 
make the change gamepads start working.
   
   So it may be the case that cordova-ios needs to configure WKWebView as they 
recommend.
   
   ### Command or Code
   See repro above. It ought to reproduce with any example that uses the 
Gamepad API if you want a more minimal repro.
   
   ### Environment, Platform, Device
   Tested on iPhone 12 Pro Max with iOS 17.2.1 and a PlayStation 4 wireless 
controller.
   
   ### Version information
   Using cordova-ios@7.0.1
   
   
   ## Checklist
   <!-- Please check the boxes by putting an x in the [ ] like so: [x] -->
   
   - [x] I searched for existing GitHub issues
   - [x] I updated all Cordova tooling to most recent version
   - [x] I included all the necessary information above
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org

Reply via email to