Search code examples
javascripthtmlbrowserkeyboardaccessibility

Virtual / on-screen keyboard for browser


I am working on a SPA which is going to run on a browser to support a digital kiosk. I am exploring the virtual/on-screen keyboard options and while I was determined to go with simple keyboard, I found out that on Linux, when I use the touch screen, Mozilla displays a virtual, on screen keyboard which works and looks pretty well (on the other hand, simple-keyboard needs a lot of tuning and coding). Is there a universal option to have this on all browsers and I am missing it? Thanks!


Solution

  • No, web technologies don't offer you a way to force a touch screen keyboard, but the operating system (OS) does, and you should use it. A JavaScript solution will always be more volatile and less fast.

    You might want to use a touch screen laptop to test your application. (:

    A responsive web app should allow for multi-modal input, meaning users should be able to switch input mode while using the app, f.e. from mouse to keyboard, or from physical keyboard to on-screen-keyboard. This is also an upcoming accessibility requirement in WCAG 2.2 Concurrent Input Mechanisms

    We have a lot of assumptions about input methods based on devices, but a smartphone user can attach a bluetooth keyboard or mouse, and might actually need to.

    This is why the web technologies do not provide "universal options" to trigger a touch screen keyboard. Instead, it puts that decision off to the platform (Browser and OS), which has more knowledge about the hardware used.

    To further illustrate this concept: the HTML attribute inputmode along with the type attribute help the browser optimise the on-screen keyboard, if displayed. But does not decide whether to display one or not.

    If the OS supports the device's touch screen, it should display a on-screen keyboard once you set focus inside an input, maybe by means of touch. Whether or not the keyboard will respect the inputmode, depends on the browser-OS combination.

    If you are able to specify the used hardware for the kiosk, you could recommend an OS that does.