spiegel-keyman/web
Eberhard Beilharz 7b2f275eb1
Merge pull request #16524 from keymanapp/fix/web/16080_kbdoff
fix(web): allow to set default keyboard to 'off'

The parameters for setKeyboardForControl basically have three different modes: - an id of a keyboard/language to set that keyboard, enabling independent keyboard mode - empty string to set the system keyboard, enabling independent keyboard mode - null to disable independent keyboard mode.

Our previous code didn't properly handle the last two modes. This change fixes the problems and also clarifies and updates the documentation.

Also included is an improvement to the guide-examples e2e tests that now wait until all keyboards are loaded (which may fix #16167).

Partially drafted by kilo.ai.

User tests will follow in an upcoming PR for #16522.

Fixes: #16080
2026-09-17 17:25:24 +02:00
..
docs fix(web): allow to set default keyboard to 'off' 2026-09-08 11:56:41 +02:00
src Merge pull request #16524 from keymanapp/fix/web/16080_kbdoff 2026-09-17 17:25:24 +02:00
.build-builder chore(web): moves main web script to /web, adds .build-builder file as flag for CI 2022-10-18 13:59:19 +07:00
.c8rc.json chore(web): fix coverage-reporting artifact 2025-02-12 15:56:54 +07:00
.gitattributes Patches up the /samples pages. 2018-01-08 09:51:19 +07:00
.gitignore test(web): add e2e tests for KMX keyboard with web-core 2025-12-05 19:13:27 +01:00
build.sh chore(android): address code review comment 2026-06-29 17:08:24 +02:00
ci.sh chore(android): upload webview source map during android and ios build 2026-08-27 18:57:18 +02:00
common.inc.sh Merge branch 'epic/autocorrect' into auto/A19S30-merge-master-into-autocorrect 2026-06-09 14:50:36 -05:00
history.md chore: merge stable history 2020-04-29 06:33:31 +10:00
index.html chore(web): address code review comments 2026-09-11 11:35:40 +02:00
LICENSE Move KeymanWeb project to web/ 2017-05-26 11:00:34 +07:00
package.json chore(deps): bump qs and express 2026-09-07 09:20:28 +00:00
README.md Merge branch 'epic/autocorrect' into auto/A19S30-merge-master-into-autocorrect 2026-06-09 14:50:36 -05:00
test.sh test(web): add e2e tests for KMX keyboard with web-core 2025-12-05 19:13:27 +01:00
tsconfig.base.json refactor(web): change @keymanapp/web-utils to keyman/common/web-utils 2025-11-06 07:24:36 +01:00

Keyman Engine for Web

The Original Code is (C) SIL Global

Prerequisites

See build configuration for details on how to configure your build environment.


The following folders contain the distribution for Keyman Engine for Web:

src                        Source code
build/app/resources        OSK + UI resources for inclusion in all build types;
                           keymanweb-osk.ttf is maintained at https://github.com/silnrsi/font-keymanweb-osk

build/app/browser/release  Fully-compiled KeymanWeb modules for release
build/app/webview/release  Fully-compiled KMEA/KMEI modules for inclusion in
                           mobile app builds
build/app/browser/debug    Fully-compiled but non-minified KeymanWeb modules
build/app/webview/debug    Fully-compiled but non-minified KMEA/KMEI modules

src/samples                Sample pages demonstrating ways to link with KeymanWeb
src/test/manual            Test-case web-pages for various aspects of KeymanWeb functionality
src/test/auto              A Node-driven test suite for automated testing of KeymanWeb

Usage

Start the test server by running ./build.sh start, then open your browser to http://localhost:3000. Be sure to compile Keyman Engine for Web before viewing the pages.

Refer to the samples for usage details.

To view pages using compiled Keyman Engine for Web,

  1. cd to keyman/web/
  2. Run ./build.sh
    • Use ./build.sh --help for the script's documentation.

Unit Testing

Before running unit tests on Keyman Engine for Web, first run ./build.sh according to the instructions above.

Once the build is complete, running npm test will run the unit testing suite on your local machine in-browser. Alternatively, see test.sh, which the former command executes.

Debugging Unit Tests

  1. During development, to run a specific unit test, change the it to it.only. You can also run all tests under a specific group with describe.only.

  2. From this directory, run ./test.sh --debug. Alternatively, from web/ or any web/ subdirectory,

    npm run test -- --debug
    

    The -- part tells npm to funnel anything to the script as the script's command-line parameters. As long as it's run from somewhere within the web/ folder's hierarchy, that line will always run from web/, as that's where package.json is.

  3. When the browser halts, click the "Debug" button which opens a new debugging tab.

  4. In the Dev console, you can set a breakpoint in your test and refresh the page to debug

Approximate Overall Design

---
title: Dependency Graph
---
%% For rendering, use e.g. https://mermaid.live
%%{init: {"flowchart": {"htmlLabels": false}} }%%
graph TD;
    OSK["/web/src/engine/osk"];
    KeyboardSpec["/web/src/engine/keyboard"];
    JSProc["/web/src/engine/js-processor"];
    OSK-->KeyboardSpec;
    WebUtils["/web/src/common/web-utils"];
    KeyboardSpec---->WebUtils;
    Wordbreakers["@keymanapp/models-wordbreakers<br>(/web/src/engine/predictive-text/wordbreakers)"];
    Models["@keymanapp/models-templates<br>(/web/src/engine/predictive-text/templates/)"];
    Models-->WebUtils;
    LMWorker["@keymanapp/lm-worker<br>(/web/src/engine/predictive-text/worker-thread)"];
    LMWorker-->Models;
    LMWorker-->Wordbreakers;
    LMLayer["@keymanapp/lexical-model-layer<br>(/web/src/engine/predictive-text/worker-main)"];
    LMLayer-->LMWorker;
    Gestures["/web/src/engine/gesture-processor"];
    Gestures-->WebUtils;

    subgraph PredText["PredText: WebWorker + its interface"]
        LMLayer;
        LMWorker;
        Models;
        Wordbreakers;
    end

    subgraph Headless["`**Headless**
    Fully headless components`"]
        direction LR
        KeyboardSpec;
        JSProc-->KeyboardSpec;
        WebUtils;
        PredText;
        Gestures;
    end

    subgraph ClassicWeb["`**ClassicWeb**
    Intermediate-level engine modules`"]
        Elements["/web/src/engine/element-text-stores"];
        Elements-->JSProc;
        KeyboardStorage["/web/src/engine/keyboard-storage"];
        KeyboardStorage-->Interfaces;
        DomUtils["/web/src/engine/dom-utils"];
        DomUtils-->WebUtils;
        DomUtils-->KeyboardSpec;
        OSK-->DomUtils;
        OSK-->Gestures;
        Interfaces["/web/src/engine/interfaces"];
        Interfaces-->KeyboardSpec;
        OSK-->Interfaces;
        CommonEngine["/web/src/engine/main"];
        CommonEngine-->Device;
        CommonEngine-->KeyboardStorage;
        CommonEngine-->OSK;
        Attachment["/web/src/engine/attachment"];
        Attachment-->DomUtils;
        Attachment-->Elements;
    end

    subgraph WebEngine["`**WebEngine**
    Keyman Engine for Web (top-level libraries)`"]
        Browser["/web/src/app/browser"];
        WebView["/web/src/app/webview"];

        WebView--->CommonEngine;

        Browser--->CommonEngine;
        Browser-->Attachment;
    end