defold icon indicating copy to clipboard operation
defold copied to clipboard

gui.hide_keyboard does not work on iOS html5 safari

Open wistpotion opened this issue 1 year ago • 8 comments
trafficstars

Describe the bug (REQUIRED) gui.hide_keyboard does not hide the virtual keyboard on iOS html5 safari

To Reproduce (REQUIRED) Steps to reproduce the behavior:

  1. make a script
  2. make the script open the virtual keyboard using gui.show_keyboard (showing the keyboard works perfectly well)
  3. run gui.hide_keyboard some time after running gui.show_keyboard
  4. success

Expected behavior (REQUIRED) gui.hide_keyboard hiding the keyboard

Defold version (REQUIRED):

  • Version 1.6.4

Platforms (REQUIRED):

  • Platforms: HTML5 (safari)
  • OS: iOS 15.8.1
  • Device: iPhone 7

wistpotion avatar Mar 09 '24 20:03 wistpotion

How are you calling the gui.hide_keyboard()? On a timer? On a user action?

britzl avatar Mar 11 '24 08:03 britzl

It is called by defolds on_input. Specifically for touch.

function on_input(self, action_id, action)
	if action_id == hash("touch") and action.pressed then
		gui.hide_keyboard()
	end
end

wistpotion avatar Mar 11 '24 14:03 wistpotion

It is called by defolds on_input. Specifically for touch.

function on_input(self, action_id, action)
	if action_id == hash("touch") and action.pressed then
		gui.hide_keyboard()
	end
end

HTML5 is a bit specific platform, taking into account all the security features that only allow calling certain functions using specific DOM events. Could you please test is using a special function we provide specifically for such cases html5.set_interaction_listener()? https://defold.com/ref/stable/html5/#html5.set_interaction_listener:callback

AGulev avatar Mar 11 '24 18:03 AGulev

Tested with set_interaction_listener, still doesn't hide the keyboard. I confirmed that the callback was actually running as well.

wistpotion avatar Mar 12 '24 10:03 wistpotion

Could you please check if you have anything in the console of the Safari Dev Tools when the device is connected and you perform the test?

https://developer.apple.com/documentation/safari-developer-tools/inspecting-ios

britzl avatar Mar 12 '24 12:03 britzl

I do not own a Mac, are there any different tools that could be used?

wistpotion avatar Mar 12 '24 13:03 wistpotion

I do not own a Mac, are there any different tools that could be used?

Maybe there's a way to read the log from Windows or Linux. I haven't looked.

britzl avatar Mar 13 '24 06:03 britzl

I’ll dig into it, might take a few days though.

On Wed, 13 Mar 2024 at 07:53, Björn Ritzl @.***> wrote:

I do not own a Mac, are there any different tools that could be used?

Maybe there's a way to read the log from Windows or Linux. I haven't looked.

— Reply to this email directly, view it on GitHub https://github.com/defold/defold/issues/8652#issuecomment-1993685270, or unsubscribe https://github.com/notifications/unsubscribe-auth/AX2GCJAM7EHIQB7P5AO3VK3YX7ZYFAVCNFSM6AAAAABEOLXDO6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOJTGY4DKMRXGA . You are receiving this because you authored the thread.Message ID: @.***>

wistpotion avatar Mar 13 '24 07:03 wistpotion

As temporary solution you can use this:

html5.run('Module["canvas"].blur()')

Works on Iphone 8 Plus.

aiteron avatar Jun 05 '24 00:06 aiteron