Mottie / Keyboard

Virtual Keyboard using jQuery ~
http://mottie.github.io/Keyboard/
Other
1.78k stars 723 forks source link

Don't disable keyboard on readonly inputs #652

Closed BastienVerschaete closed 6 years ago

BastienVerschaete commented 6 years ago

Hello @Mottie

I'm having an issue using your keyboard concerning readonly inputs, I found that simply removing the code adding the noKeyboard class to readonly inputs fixes that problem. Would it be possible to add an option in the config (keyboardReadOnly, default false) that removes this part of the code and if so, would you be open to a pull request?

Thanks in advance

Edit: or is there a way that I can remove that no keyboard class on initialization?

Mottie commented 6 years ago

Hi @BastienVerschaete!

I'm not sure how the "ui-keyboard-nokeyboard" class is causing issues. Maybe you could alter the class name before initializing the plugin as follows:

$.keyboard.css.noKeyboard = "";

If I'm misunderstanding, then yes a pull request would be great!

BastienVerschaete commented 6 years ago

Thanks for the quick response, I'm sorry, I was a bit confused, the class name had nothing to do with it, I'm specifically talking about

https://github.com/Mottie/Keyboard/blob/e4f9dd3487b37a88ed2873d42183d84da9c98496/js/jquery.keyboard.js#L353-L355

As far as I'm understanding this correctly, the keyboard won't reveal when the readonly attribute is present. Our application specifically has to have a working virtual-keyboard on mobile while the native mobile keyboard is being blocked, as many issues before me have already tried to do. This is almost only accomplished by making inputs readonly, but due to these lines, the virtual keyboard is blocked.

A readonly input is still selectable and the virtual-keyboard is still able to enter text. This is not the case with a disabled input. I suggest making a config option that perhaps omits the || (base.$el.attr('readonly') && !base.$el.hasClass(kbcss.locked)) piece? If you are too busy I would be glad to make a pull request.

Thank you

BastienVerschaete commented 6 years ago

Maybe worth mentioning, the desktop version of my application doesn't have the readonly fields, so the user still has to be able to type in the inputs, so setting the lockInput option to true isn't really an option either.

Mottie commented 6 years ago

Yes, it would help if you could find an optimal solution. Maybe a new option is needed here?

Mottie commented 6 years ago

I'm working out some bugs on some necessary changes. Once I get that done, I'll push a new release.

Mottie commented 6 years ago

And thanks again for your help!

BastienVerschaete commented 6 years ago

No problem, appreciate your quick responses! Any ETA on when that next release might be?

Mottie commented 6 years ago

soon, I hope.

BastienVerschaete commented 6 years ago

Thanks!