How to hide iPad keyboard in Safari + designMode=on

1.4k Views Asked by At

iOS5 now supports designMode=On. I set that on a document of an iframe and it works pretty well. Now I want to hide the onscreen keyboard with Javascript after clicking on an image inside that editable document (=iframedoc in my case). I tried iframedoc.blur(), iframedoc.activeElement.blur(),iframedoc.body.blur() or iframe.contentWindow.blur() and I also tried to set the focus to a hidden link or a submit button but it is not working for me.

For text input fields just blur seems to work but I have a designmode=on document so the solutions for this question are not working for me: iPad Safari - Make keyboard disappear

3

There are 3 best solutions below

0
On

it seems that after hours I found a workaround: 1. set focus to another standard input field on screen so the keyboard is connected to that field 2. make a blur() of that field

this workaround is a bit complicated to handle because it scrolls the view to that other field. So that has to be solved as well like with a moving input field.

0
On

Here is a great solution found from this stack answer, I was stuck on this too.

0
On

Call preventDefault() in the event handler for the 'touchstart' event.