You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(widgets): show numeric keypad on mobile for currency and numeric inputs (fixes #41496) - #42252
When users focused on Currency Input or Numeric Input widgets on mobile devices (e.g. iOS Safari, Android Chrome), the browser displayed the full alphabetical (QWERTY) keyboard instead of a numeric keypad. This occurred because Blueprint's underlying <input> element uses type="text" to allow custom formatting, but lacked an HTML5 inputmode attribute.
This PR adds inputMode="decimal" to StyledNumericInput in BaseInputComponent, prompting mobile browsers to display the numeric keypad with decimal support.
Testing
Automated Tests
Added unit test in BaseInputWidget/component/index.test.tsx verifying that the rendered numeric <input> element has inputmode="decimal".
Manual Testing
Verified that focusing currency and numeric input components on mobile view triggers the numeric keypad with decimal point.
Checklist:
My code follows the style guidelines of this project
I have performed a self-review of my own code
I have made corresponding changes to the documentation
My changes generate no new warnings
I have added tests that prove my fix is effective or that my feature works
New and existing unit tests pass locally with my changes
Any dependent changes have been merged and published in downstream modules
Credential-free formatting, lint, type, and unit checks will run after GitHub's workflow approval. An Appsmith maintainer will start privileged integration tests or a deploy preview when needed.
No action is required from you while this PR has the awaiting-maintainer label.
It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.
Numeric fields now use a decimal-optimized keyboard on supported devices.
Numeric input accepts alternate decimal separators and normalizes values according to the selected locale. It also handles grouped digits, repeated or trailing separators, full-width digits, and nonnumeric characters more consistently.
Tests
Added coverage for decimal input mode and locale-aware numeric input handling.
Numeric inputs now normalize values using the expected decimal separator and filter disallowed keypresses. The component also converts full-width digits and removes characters outside its allowed set. Numeric inputs declare decimal input mode. Tests cover input mode, keypress filtering, and normalization for en-US and de-DE.
Changes
Layer
Summary
Normalize numeric values
Numeric changes are normalized using locale-aware separators and character rules. Tests cover separator conversion and filtering.
Filter keypresses and render decimal input
Numeric inputs use custom keypress filtering and declare decimal input mode. Tests cover these behaviors for supported locales.
sequenceDiagram
participant Input
participant BaseInputComponent
participant LocaleUtils
participant onValueChange
Input->>BaseInputComponent: numeric value change
BaseInputComponent->>LocaleUtils: get locale decimal separator
LocaleUtils-->>BaseInputComponent: expected separator
BaseInputComponent->>BaseInputComponent: normalize numeric value
BaseInputComponent->>onValueChange: normalized value
Loading
Suggested reviewers:amelia-c0n, kelvinom
Merge Risk: Moderate · previous review ecd5d
Pasting a grouped number such as 1,234 into a Currency or Numeric Input in an en-US locale can now be read as 1.234, silently changing the amount. This should be resolved or explicitly accepted before merge. The decimal keypad change itself is low risk.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the primary change: numeric keypad display on mobile for currency and numeric inputs, with the issue reference. The PR also adds locale-aware decimal normalization, which the title doe…
Description check
The description follows the template's Description and Testing sections and links issue #41496 with a clear problem statement, fix, and test notes. It omits the TL;DR (not required under 500 words), l…
Linked Issues check
[#41496] requires Currency Input on iOS Safari to open a numeric keypad. The issue names inputmode="numeric" or type="tel" as examples. The reviewed head sets inputMode="decimal" on `StyledNumer…
Out of Scope Changes check
The whole-PR diff changes two files. BaseInputWidget/component/index.tsx adds inputMode="decimal", disables Blueprint's allowNumericCharactersOnly filter for numeric inputs, and adds `normalizeN…
Full details: Title check
Explanation
The title names the primary change: numeric keypad display on mobile for currency and numeric inputs, with the issue reference. The PR also adds locale-aware decimal normalization, which the title does not mention, but the title still covers the main change and is specific.
Full details: Description check
Explanation
The description follows the template's Description and Testing sections and links issue #41496 with a clear problem statement, fix, and test notes. It omits the TL;DR (not required under 500 words), leaves the validation checklist and Communication section unselected, and does not mention the later normalization commit described in the objectives. The description is mostly complete but out of date with the full scope of the PR.
Resolution
Optionally update the description to cover the follow-up change: disabling allowNumericCharactersOnly, custom decimal separator normalization across keypress, IME/onChange, and paste, and the new unit tests. Also tick the applicable validation boxes (Client unit tests) and answer the Communication question.
Full details: Linked Issues check
Explanation
[#41496] requires Currency Input on iOS Safari to open a numeric keypad. The issue names inputmode="numeric" or type="tel" as examples. The reviewed head sets inputMode="decimal" on StyledNumericInput in BaseInputWidget/component/index.tsx. This value gives a decimal-capable numeric keypad, which satisfies the stated goal. The diff also adds a unit test in BaseInputWidget/component/index.test.tsx that checks the rendered input has inputmode="decimal". The follow-up commit adds keystroke, IME/onChange, and paste normalization for . and ,. These changes do not remove the keypad attribute. Device-level keypad behavior was checked manually only, which is not a coding requirement. No other coding requirement from #41496 is present.
Full details: Out of Scope Changes check
Explanation
The whole-PR diff changes two files. BaseInputWidget/component/index.tsx adds inputMode="decimal", disables Blueprint's allowNumericCharactersOnly filter for numeric inputs, and adds normalizeNumericInputValue with keypress handling. The test file covers the new attribute and normalization behavior. The normalization logic goes beyond the bare attribute in the issue. It is still connected to the issue goal. A decimal keypad shows the locale decimal symbol, such as , for de-DE. Without this handling, the widget would reject the separator that the new keypad produces. The change stays inside the numeric input path of the same widget, so no concrete unrelated change is shown. Reviewers should still confirm that the custom filtering does not regress existing numeric input behavior, but that is a correctness concern, not a scope violation.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
The reason will be displayed to describe this comment to others. Learn more.
Thanks for picking this up.
Blocked on a decimal-entry bug found on the DP: Currency Input (2 decimals) shows the numeric keypad, but tapping the decimal key does not insert anything - this is an edge case.
What’s going on: inputMode="decimal" asks the OS for a decimal keypad. That keypad’s separator key follows the phone’s region (for some regions, it's ,). Appsmith’s Blueprint NumericInput only accepts the separator from the browser language (navigator.languages[0] / getLocale()). For English locales that is .. When region and language disagree, the only separator on the pad is rejected by allowNumericCharactersOnly, so fractional values cannot be entered. A full keyboard hid this; the decimal pad makes it a hard failure.
@amelia-c0n Thank you for catching that on the DP! I've pushed commit \1247c8e\ to handle the mismatch between OS keypad region and browser locale:
Disabled Blueprint's strict \�llowNumericCharactersOnly\ keystroke blocker on \StyledNumericInput\ and replaced it in \BaseInputComponent\ with custom numeric filtering (\onNumericKeyPress\ +
ormalizeNumericInputValue\ in \onNumberChange).
Both .\ and ,\ are now accepted on \keyPress\ and normalized to the expected decimal separator (\getLocaleDecimalSeperator()\ when \shouldUseLocale\ is enabled, or .\ otherwise) across \keyPress, Android IME / \onChange, and paste — while stripping extra/thousand separators and non-numeric characters.
Added unit tests in \BaseInputWidget/component/index.test.tsx. Ready for a fresh DP / re-test!
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
Review details
Context from checks skipped due to timeout: 1
GitHub Check: CodeRabbit
Additional context used
Learnings: 1
Common learnings
Learnt from: sharat87
Repo: appsmithorg/appsmith PR: 34317
File: deploy/docker/fs/opt/appsmith/pg-upgrade.sh:20-20
Timestamp: 2024-10-08T15:32:34.115Z
Learning: Code submissions in the Appsmith project should use 2-space indentation as specified in the project's root `.editorconfig` file.
Learnt from: sharat87
Repo: appsmithorg/appsmith PR: 34317
File: deploy/docker/fs/opt/appsmith/pg-upgrade.sh:20-20
Timestamp: 2024-06-20T02:28:35.174Z
Learning: Code submissions in the Appsmith project should use 2-space indentation as specified in the project's root `.editorconfig` file.
The reason will be displayed to describe this comment to others. Learn more.
Major · Data Integrity & Integration · Quick win
Preserve grouped integers when normalizing pasted values.
For an en-US input, pasting 1,234 now produces onValueChange("1.234"). Previously, Blueprint removed the grouping comma and forwarded "1234". Disabling Blueprint’s filter exposes the raw paste to this condition, which treats every single comma as a decimal separator. This silently changes the amount. (raw.githubusercontent.com)
Handle locale-formatted grouping separately from alternate keypad separators, or reject ambiguous pasted values. Add regression cases for en-US 1,234 and de-DE 1.234, while preserving alternate-decimal entry such as 12,34.
The reason will be displayed to describe this comment to others. Learn more.
Hello Chinmay,
Please address CodeRabbit’s comment before we merge: pasting a grouped number like 1,234 (en-US) or 1.234 (de-DE) currently becomes a decimal (1.234 / 1,234) instead of 1234.
We still need the mobile keypad path to work — alternate , / . as a decimal for values like 25, or 12,34 — but pasted thousands without a locale decimal should not silently change the amount. Prefer stripping the grouping character(s) to match the old Blueprint behavior, or reject that paste. Please add unit tests for both the keypad cases and those paste cases.
I can re-test on the DP once that is up.
This branch has not been deployed
No deployments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
awaiting-maintainerThe next action on this pull request belongs to an Appsmith maintainerexternal-contributionPull request submitted from outside the Appsmith repository
2 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #41496
When users focused on Currency Input or Numeric Input widgets on mobile devices (e.g. iOS Safari, Android Chrome), the browser displayed the full alphabetical (QWERTY) keyboard instead of a numeric keypad. This occurred because Blueprint's underlying
<input>element usestype="text"to allow custom formatting, but lacked an HTML5inputmodeattribute.This PR adds
inputMode="decimal"toStyledNumericInputinBaseInputComponent, prompting mobile browsers to display the numeric keypad with decimal support.Testing
Automated Tests
BaseInputWidget/component/index.test.tsxverifying that the rendered numeric<input>element hasinputmode="decimal".Manual Testing
Checklist: