1

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

Community
  • 1
  • 1
imperator
  • 181
  • 1
  • 8

3 Answers3

3

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

1

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.

imperator
  • 181
  • 1
  • 8
0

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

Community
  • 1
  • 1
Leon Gaban
  • 36,509
  • 115
  • 332
  • 529