Skip to content

fix(widgets): show numeric keypad on mobile for currency and numeric inputs (fixes #41496) - #42252

Open
Chinmay0608 wants to merge 6 commits into
appsmithorg:releasefrom
Chinmay0608:fix/currency-input-numeric-keypad
Open

Chinmay0608 wants to merge 6 commits into
appsmithorg:releasefrom
Chinmay0608:fix/currency-input-numeric-keypad

Conversation

@Chinmay0608

@Chinmay0608 Chinmay0608 commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

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 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

@Chinmay0608
Chinmay0608 requested a review from a team as a code owner September 17, 2026 16:12
@github-actions github-actions Bot added awaiting-maintainer The next action on this pull request belongs to an Appsmith maintainer external-contribution Pull request submitted from outside the Appsmith repository labels Sep 17, 2026
@github-actions

Copy link
Copy Markdown

Thanks for contributing to Appsmith!

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.

@coderabbitai

coderabbitai Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Note

Reviews paused

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.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • Resume reviews
  • Review completed - (Check again to review again)
Summary

Summary by CodeRabbit

  • Enhancements
    • 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.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix · Severity of issue fixed: Low

Sequence Diagram(s)

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: Passed 4

Check name Status Explanation
Title check Passed 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 Passed 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 Passed [#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 Passed 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

@Chinmay0608
Chinmay0608 force-pushed the fix/currency-input-numeric-keypad branch 3 times, most recently from 20445e1 to 91ccf6a Compare October 6, 2026 08:10
@Chinmay0608
Chinmay0608 force-pushed the fix/currency-input-numeric-keypad branch from 91ccf6a to 50acd25 Compare October 10, 2026 19:03
@amelia-c0n

Copy link
Copy Markdown
Contributor

/build-deploy-preview skip-tests=true

@github-actions

Copy link
Copy Markdown

Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/44112092209.
Workflow: On demand build Docker image and deploy preview.
skip-tests: true.
env: ``.
PR: 42252.
recreate: .
base-image-tag: .

coderabbitai[bot]
coderabbitai Bot previously approved these changes Nov 17, 2026
@github-actions

Copy link
Copy Markdown

Deploy-Preview-URL: https://ce-42252.dp.appsmith.com

@amelia-c0n amelia-c0n left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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.

Happy to re-test on the DP after you fix it.

@Chinmay0608

Copy link
Copy Markdown
Contributor Author

@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!

@amelia-c0n

Copy link
Copy Markdown
Contributor

/build-deploy-preview skip-tests=true

@github-actions

Copy link
Copy Markdown

Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/44721640454.
Workflow: On demand build Docker image and deploy preview.
skip-tests: true.
env: ``.
PR: 42252.
recreate: .
base-image-tag: .

@github-actions

Copy link
Copy Markdown

Deploy-Preview-URL: https://ce-42252.dp.appsmith.com

@amelia-c0n

Copy link
Copy Markdown
Contributor

/build-deploy-preview skip-tests=true

@github-actions

Copy link
Copy Markdown

Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/44730773511.
Workflow: On demand build Docker image and deploy preview.
skip-tests: true.
env: ``.
PR: 42252.
recreate: .
base-image-tag: .

@github-actions

Copy link
Copy Markdown

Deploy-Preview-URL: https://ce-42252.dp.appsmith.com

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between d076b8a and ecd5d31.

Files selected for processing: 2

  • app/client/src/widgets/BaseInputWidget/component/index.test.tsx
  • app/client/src/widgets/BaseInputWidget/component/index.tsx

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.

const firstIdx = normalized.indexOf(alt);

// Only treat a single alternate separator as a decimal point (multiple occurrences are thousand separators).
if (firstIdx !== -1 && normalized.indexOf(alt, firstIdx + 1) === -1) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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.

@amelia-c0n amelia-c0n left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting-maintainer The next action on this pull request belongs to an Appsmith maintainer external-contribution Pull request submitted from outside the Appsmith repository

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Currency Input should open numeric keypad on iOS (inputmode/type missing)

2 participants