xontab / chrome-virtual-keyboard

Touch-friendly Virtual Keyboard for Chrome browser
http://apps.xontab.com/VirtualKeyboard/
MIT License
58 stars 68 forks source link

Dynamic form content #5

Open EHLOVader opened 8 years ago

EHLOVader commented 8 years ago

This doesn't appear to be working correctly for fields that are added to the page dynamically after load.

I don't see why or how this could be, but the only inputs which aren't working are added in this way.

georgwaechter commented 8 years ago

I searched through the code (script.js) and it seems the extension looks for <input fields etc only on initial load. I guess the function "init_virtualKeyboardChromeExtension" should be loaded every time the DOM changes.

My application needs this case too (in the future) - maybe I'll improve the extension in a few weeks.

All the best

Georg

EHLOVader commented 8 years ago

It does call on interval though, so I am thinking it may actually work but I was affected by another problem with how this initializes and marks inputs. I have been meaning to return after I confirm, and test a bit more. Both of my issues may be related.

What happened to me was the dynamic form content was generated by cloning a hidden element. That element was still seen by virtual keyboard though and initialized with event listeners and an attribute. That attribute was cloned but the event listener wasn't so it created problems.

As far as I can tell I just need to remove the attribute or deep clone. Cloning all the event listeners may be a bad choice so I have had some success with this on my clone:

.removeAttr('_vkenabled')