tiff / wysihtml5

Open source rich text editor based on HTML5 and the progressive-enhancement approach. Uses a sophisticated security concept and aims to generate fully valid HTML5 markup by preventing unmaintainable tag soups and inline styles.
http://xing.github.com/wysihtml5/
MIT License
6.49k stars 1k forks source link

wysihtml5 focus/click iphone #62

Closed brainztorm closed 12 years ago

brainztorm commented 12 years ago

Hi Christopher,

First thanks for this rich text editor which is very good !

Secondly, i'm trying to make the focus work on an iphone ... seems too hard for me :/

To simulate the click event (safari ios don't work with focus(), it seems that we have to simulate a click event to make the iphone keyboard appear), I've tried this :

But nothing is working ...

Maybe you have a solution for that ?

Thanks in advance,

François.

tiff commented 12 years ago

Hi!

which iOS and wysihtml5 version are you testing on?

Thanks!

brainztorm commented 12 years ago

Sure :)

ios5.x and the lastest wysihtml5 (wysihtml5-0.3.0_rc2) You can reproduce this with an "autofocus" parameter on the textarea

Thanks for your response Christopher.

Chriztoph commented 12 years ago

hello, (=

i have the same issue as brainzstorm... do you have any soloution for this problem? if i write text and tap on the textarea again... i cant write any text ... i must click outside and inside again to make it working.

thanks

brainztorm commented 12 years ago

Christopher, Maybe you don't have any iphone near you for testing. I have one so don't hesitate if you need to test something.

Have a good day.

Chriztoph commented 12 years ago

hello (=

i have testet the editor on my sencha touch 2.0.1 app on the iphone with iOS 5.1.1. i have testet it also without the sencha touch library... and it also wont work. i have the same issue as you described... with a little difference...

  1. i tap on the editor the enter the text... the iphone keyboard pops up
  2. i write text on the iphone keyboard all works perfectly
  3. i tap on any char in the editor... this prevents the iphone keyboard to enter more text

To fix the issue i must tap outside the editor and tap inside again ... to be able to write more text in the editor. So anyhow the tap on the editor prevents the iphone keyboard to enter text.

I cant tell the user to tap in and outside after each action... so i need a better solution to do this.

tiff commented 12 years ago

Thanks @Chriztoph, @brainztorm. This is really an issue and I'm already working on this for v0.4 to be fixed. I have an iPad which should be perfect for testing. I assume it behaves exactly the same as the iPhone.

What I can definitely say is that this is a bug in iOS which I need to find a proper workaround for.

Chriztoph commented 12 years ago

Hey Christopher,

thanks for your reply and your time working on that awesome WYSIWYG Editor. its the only one that fully works on the iOS 5.1.1 the only thing that dont work is my problem i described above.

i spent some hours today testing all things... i tryed the following things:

  1. canceled (uncommented all events from the editor)
  2. splitted the editor in 2 elements... textarea and iframe
    • here i can say that all works perfektly on the textarea but on the iframe the problem comes out
    • it seems that some events from the 2nd body element in the iframe causes that problems
  3. tryd to set an event on the iframe tap... with an blur() and focus() again to simulate the needed user action.
    • this cant work cause only on native apps blur and focus opens and cancels the iphone keyboard.
  4. tryd to find a way to open and close the keyboard...
    • this will only work if you create a native app with sencha touch.
  5. i testet all wysihtml5 versions no changes

i use Sencha Touch 2.0.1 and included the editor on a panel label html... i think some events from sencha or a mystic constelation of the editor events and the library ones... the error also is reproduceable on the wysihtml5 example (advanced) page... but it wont happen all time... just sometime it will occur... with sencha touch 2.0.1 it will occur everytime i tap somewhere and have the keyboard open.

here is a source from the near same problem: http://openradar.appspot.com/6089245

I hope this helps you to find the problem :) Please post here if you have any quick fix or fixed it in a release.

And thanks for your hard work :)

Greetz Chriz

Chriztoph commented 12 years ago

Hello Christopher :)

have you found any solution for my problem i described above?

greetz Chriz

tiff commented 12 years ago

Hey @Chriztoph,

I was only able to reproduce the autofocus issue. After some researching I figured that it doesn't seem to be possible at all to auto focus an element having contentEditable=true. The user must always click. So I decided to omit the autofocus logic in ios for now. See 810dd7708ac125a389ce73d9e531307800ee0ba5

brainztorm commented 12 years ago

Thanks for the updates :)

Christopher Blum notifications@github.com a écrit :

Hey @Chriztoph,

I was only able to reproduce the autofocus issue. After some researching I figured that it doesn't seem to be possible at all to auto focus an element having contentEditable=true. The user must always click. So I decided to omit the autofocus logic in ios for now. See 810dd77

— Reply to this email directly or view it on GitHub.

tiff commented 12 years ago

I'm closing this since I can't reproduce any of the other problems mentioned here. Feel free to reopen if you are still experiencing issues with the current master.

brainztorm commented 12 years ago

Hi @tiff , I'm able to reproduce this problem on ios6 with the current release (compiled today).

it will be my pleasure to help you on that: i have an iphone 4 and a nexus 7 tablet and a mac (ios simulator for ipad etc …)

Don't hesitate to send me some version you want me to test.

François. brainztorm1_air_obase.gmail.com

tiff commented 12 years ago

@brainztorm are you talking about the autofocus/keyboard issue? I'm able to reproduce that as well and I already investigated it. See my comment above (https://github.com/xing/wysihtml5/issues/62#issuecomment-8176247)

brainztorm commented 12 years ago

Ok great news tiif ! :) As soon as you fix this i will test it :)

tiff commented 12 years ago

@brainztorm I didn't fix it and I can't fix it. It doesn't seem to be possible to automatically set the focus on the editor. Sorry! Let me know if you know any workaroudn.

brainztorm commented 12 years ago

Ok sure !