Experimenting with "Add KeymanWeb to a Website" + "Add custom keyboard to a Website"

I am testing the possibility of adding a custom keyman keyboard to a web page (so all javascript). I used the code from this page :
https://keyman.com/developer/keymanweb/

My custom keyboard seems OK when tested in the keyman environment bu when I add it as a parameter, javascript complains:

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading ‘setTitleFromKeyboard’)
TypeError: Cannot read properties of undefined (reading ‘startHide’)

Here is the code (the language code is rubbish, I am only testing at this stage) :

<script src='https://s.keyman.com/kmw/engine/17.0.326/keymanweb.js'></script>
<script src='https://s.keyman.com/kmw/engine/17.0.326/kmwuitoggle.js'></script>
<script>
  (function(kmw) {
    kmw.init({attachType:'auto'});
    kmw.addKeyboards('@en'); // Loads default English keyboard from Keyman Cloud (CDN)
    kmw.addKeyboards('@th'); // Loads default Thai keyboard from Keyman Cloud (CDN)
  })(keyman);
</script>


<script>
keyman.addKeyboards({
          id:'testpierre',
          name:'Sava de Esperantujanismo',
          languages:{
            id:'tdd-Latf-AS',
            name:'Eujao'
          },
          filename:'./testpierre.js'
        });
</script>


<H1>TEST</H1>
 <h1>KeymanWeb Sample 1</h1>
    <textarea cols="20" rows="5"></textarea>

Would you have any hint?

Welcome to the community @pgod,

It is a bug in KeymanWeb.
Thanks to @joshua_horton for finding the underlying issue, and created a bug report here.

This code is a workaround for now until the bug get fixed:

<head>
    <title>KeymanWeb</title>
    <script src='https://s.keyman.com/kmw/engine/17.0.326/keymanweb.js'></script>
    <script src='https://s.keyman.com/kmw/engine/17.0.326/kmwuitoggle.js'></script>
    <script>
        (function (kmw) {
            kmw.init({ attachType: 'auto' }).then(() => {
                kmw.addKeyboards('@en'); // Loads default English keyboard from Keyman Cloud (CDN)
                kmw.addKeyboards('@th'); // Loads default Thai keyboard from Keyman Cloud (CDN)
                keyman.addKeyboards(
                    {
                        name: 'Sava de Esperantujanismo',
                        id: 'testpierre',
                        filename: './testpierre.js',
                        languages: {
                            name: 'Eujao',
                            id: 'tdd-Latf-AS',
                        }
                    });
            });
        })(keyman);
    </script>
</head>

<body>
    <H1>TEST</H1>
       <h1>KeymanWeb Sample 1</h1>
         <textarea cols="20" rows="5"></textarea>
</body>

</html>

Should there be any further questions, please let us know.

Thank you!

A post was split to a new topic: Basic French keyboard on physical AZERTY keyboard

This topic was automatically closed after 14 days. New replies are no longer allowed.