lavolp3 / MMM-Keyboard

A MagicMirror module displaying a virtual keyboard for touch devices. The keyboard can be used to send any input to other modules.
MIT License
4 stars 3 forks source link

Initialization issue ? #1

Closed jheyman closed 4 years ago

jheyman commented 4 years ago

Hi,

This module sounds like exactly what I'm after, since I'm using MagicMirror (2.10.1) on a touchscreen display. I installed it (no issue), copy/paste the example config i.e. :

    {
                    module: "MMM-Keyboard",
                    disabled: false,
                    position: "top_left",
                    config: {
                    locale: "de-DE"
                    }
    },

and nothing shows up. After inspecting the developer console logs from a browser, I can see the following error, which happens only when I enable MMM-Keyboard:

TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'.

EDIT: to be more complete, here are the console logs with ONLY MMM-Keyboard enabled:

Initializing MagicMirror.
translator.js:202 Loading core translation file: translations/fr.json
translator.js:225 Loading core translation fallback file: translations/en.json
loader.js:179 Load script: modules/MMM-Keyboard//MMM-Keyboard.js
module.js:476 Module registered: MMM-Keyboard
loader.js:150 Bootstrapping module: MMM-Keyboard
loader.js:179 Load script: modules/MMM-Keyboard/node_modules/simple-keyboard/build/index.js
loader.js:155 Scripts loaded for: MMM-Keyboard
loader.js:194 Load stylesheet: modules/MMM-Keyboard/node_modules/simple-keyboard/build/css/index.css
loader.js:157 Styles loaded for: MMM-Keyboard
loader.js:159 Translations loaded for: MMM-Keyboard
loader.js:194 Load stylesheet: css/custom.css
main.js:473 All modules started!
module.js:156 MMM-Keyboard received a system notification: ALL_MODULES_STARTED
TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'.
    at updateModuleContent (main.js:213)
    at main.js:141
    at new Promise (<anonymous>)
    at updateDomWithContent (main.js:139)
    at main.js:121

Any idea what I am missing ?

lavolp3 commented 4 years ago

This module is not finished yet but I am working on it as we write. :-) Give me a bit of time and I'll finalize it. Tonight or tomorrow.

jheyman commented 4 years ago

Wow, talk about good timing :) Thank you for the lightning fast response !

jheyman commented 4 years ago

Hi Dirk,

Just wanted to let you know that whenever you are ready I'm willing to alpha-test any early version you may have, this virtual keyboard thing is a cornerstone of my MM project idea so I'm eager to figure out if there's hope that it will actually work for my need.

Cheers

lavolp3 commented 4 years ago

I'm very close. Just give new a few more days :-) Then I'm happy if you alpha- test it and we can exchange ideas about our dashboards

lavolp3 commented 4 years ago

OK, I have finally a working version available.

Please pull it, have a look at the Readme, try it out and let me know if it works for you. My best idea for now is to work with notifications as communication channel with other modules. The problem is obviously that every other module needs to have the sendNotification implemented for this to work. I still think it's the best way to make sure that every module can use the keyboard for its own purpose. Let me know if you have a better idea.

There's still lots of things I have in mind as improvements. Locales, different styles. Oh, there's so much to be done :-)

jheyman commented 4 years ago

Excellent thanks, I will try it out tonight after work, and report here. Using notifications is exactly what I had in mind, and it works great for the MMM-OnScreenMenu module I'm already using, so that should be quite fine.

jheyman commented 4 years ago

So, here are the results of my tests so far:

then the keys that are outside the region work fine, while the keys that are inside/overlapping the region do not work. I'll look into the code to see if I can figure it out, but if you can tell what's wrong, even better

EDIT: allright, not a bug, just a matter of how the regions overlap and what is the Z-index of each one. For the sake of thesting I tried adding this to my custom.css:

.region.bottom.left { z-index: 999; }

and now the keyboard works fine for all keys.

lavolp3 commented 4 years ago

Great! Would have aimed for the z-Index as well. Thanks for the feedback! Much appreciated. Closing this for now. Will publish this module on the forum as well.