question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`.type()` does not visually display commas in `input type=number` when locale normally displays commas

See original GitHub issue

Occurrence: browser with polish language setting (change to reproduce) because input behavior depends on your location/lang settings

Current behavior:

cy.type skips the coma in decimals on input type=number when typing

When I try to type eg. 2,99 on input cypress types 299 (without coma). It works with . (dot).

Desired behavior:

cy.type types correct decimal values eg. 2,99; 9,99; 100,9; (with comas)

Test code to reproduce

Reproduce on any number input form, but change to eg. polish language of browser (or other uses coma as separator in decimal number format)

it('Test INPUT NUMBER issue', function () {
  cy.viewport(800, 600);
  cy.visit('http://maniax.pl/input-number.html');
  cy.get('[type="number"]').type('9,99').type('{enter}');
});

Versions

Cypress since 4.8.0 to 4.11.0 latest Chrome, Chromium, Edge Windows 10 x64 NPM 6.14.5 Enviroment/locale: Polish Language of webbrowser: polish BUG-COMA-INPUT-2020-06-22_14h03_46 BUG-2020-06-22_14h05_38

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:8
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

8reactions
tobmastercommented, Nov 27, 2020

We have the same issue and I think this bug is underrated and much more serious. Cause while typing in a german locale (where , is the fraction deparator and . is the thousands separator) its not send to the field cause Cypress thinks its invalid as number. But in our locale its perfectly fine. Its not only a visual bug, it makes our numeric inputs not working at all when it is floating point number.

If native events really fix it and take time until released there should be a workaround in cypress or a bugfix release that is fixing the issue in keyboard.js.

Hopefully I got this right.

7reactions
theTestingApproachcommented, Sep 28, 2021

Still facing this issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why ionic ion-input type="number" does not allow comma in ...
When i build the app in ios (Iphone 14, ios 16) the keyboard shows a comma , but when i input a value...
Read more >
<input type="email"> - HTML: HyperText Markup Language
The input is now considered valid when a single email address is entered, or when any number of email addresses separated by commas...
Read more >
Import or export text (.txt or .csv) files - Microsoft Support
To export data from Excel to a text file, use the Save As command and change the file type from the drop-down menu....
Read more >
Adding custom formatting to numeric fields | Looker
Excel-style formatting does not support many international number formats, ... Dollars with 2 decimals, positive values displayed normally, ...
Read more >
Comma Style in Excel | How to Apply? | Shortcut Keys to Use
The comma style is a formatting style used in visualizing numbers with commas when the values are over 1000. Such as, if we...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found