-
Notifications
You must be signed in to change notification settings - Fork 724
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can it initialise globally? #558
Comments
Hi @ZeeCoder! Currently, no you will need to initialize the plugin on an existing input or textarea. Eventually, I do plan on making it initialize and have it set to include or exclude inputs and textareas with a certain class when they get focused. |
👍 |
@Mottie I was thinking about a bit of a hacky solution for the time being: in a loop (running every ~200ms) I would initialise all new input / textarea fields automatically. However I wonder if this approach may introduce memory leak issues, since I might not be able to destroy the plugin on certain elements. I'd assume that as long as the plugin uses jQuery.data on the element, that gets cleaned up automatically. As to why I might not be able to call destroy manually: |
Hi @ZeeCoder! I guess initializing the keyboard on new inputs would work, but what if a keyboard is already open? Doesn't the caret jump around (if it isn't set at the end)? I don't think there would be a memory leak as the keyboard is destroyed as soon as it is closed (properly). I could optimize the code a bit more... I know it needs some loving. Maybe before I start my rewrite, I could use delegated binding from the body and remove all internal element caches to make it work with React a little better. |
It looks like it works just fine, React won't open the keyboard automatically when it's already open. So the flow is something like: |
Is there a way to initialise one instance of the keyboard, instead of calling it on all elements?
So instead of calling $().keyboard() on the specific element, I would just initialise it once, globally, and then whenever I click inside an input / textarea, it would open the virtual keyboard.
The text was updated successfully, but these errors were encountered: