Skip to content

@ symbol typed as "2" on Ubuntu (keyboard layout issue) #618

@agn-7

Description

@agn-7

Version
"@nut-tree-fork/nut-js": "^4.2.6",

Short overview
When using keyboard.type('@') on Ubuntu, the character "2" is typed instead of "@". The same code works correctly on macOS.

Issue occurs on

  • Virtual machine
  • Docker container
  • Dev/Host system

node version:
v20.16.0

OS type and version:
Ubuntu 22.04

Detailed error description
Apparently, there is an issue with typing special characters like "@" symbol only on Linux.

Full code sample to reproduce
Here is a reproducable code snippet:

import { keyboard } from '@nut-tree-fork/nut-js';

async function reproduceIssue() {
  console.log('Click in a text field in 3 seconds...');
  await new Promise(resolve => setTimeout(resolve, 3000));
  
  console.log('Attempting to type: @');
  await keyboard.type('@');
  
  console.log('Check the text field - it shows "2" instead of "@"');
}

reproduceIssue().catch(console.error);

Expected Behavior
The "@" symbol should be typed in the text field.
Actual Behavior
The character "2" is typed instead of "@".
Test Results
Running comprehensive tests shows the issue consistently:

Input: "[email protected]"
Output: "info2yahoo.com"

Input: "@"
Output: "2"

Input: "@@@"
Output: "222"

Additional content

  • The issue occurs with all typing methods (whole string, character by character, with delays)
  • Other special characters may also be affected (not tested)
  • Works correctly on macOS
  • This appears to be a keyboard layout mapping issue

Please provide any (mandatory) additional data to reproduce the error (Dockerfiles etc.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions