Skip to content

feat(ui5-numeric-input, ui5-step-input): use extended numeric keyboard and locale-independent formatting on mobile - #14178

Open
GDamyanov wants to merge 5 commits into
mainfrom
numeric-step-input-mobile-keyboard
Open

GDamyanov wants to merge 5 commits into
mainfrom
numeric-step-input-mobile-keyboard

Conversation

@GDamyanov

@GDamyanov GDamyanov commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

On mobile devices, ui5-numeric-input (and by extension ui5-step-input) previously used a plain text input, which opened the standard keyboard instead of the extended
numeric keyboard. This PR switches the component to use the numeric keyboard on mobile and ensures the number format is always compatible with it.

Changes

Extended numeric keyboard on mobile (input[type=number])

The inner input now uses type="number" on non-desktop devices instead of type="text". This causes mobile browsers to display their extended numeric keyboard (with
decimal point, minus sign, and digit keys) when the field is focused, improving usability significantly.

Locale-independent formatting on mobile

type="number" inputs require the value to be in a machine-readable format — the browser rejects locale-specific formats. To ensure compatibility across all locales:

  • The decimal separator is always . (never , as in German, French, etc.)
  • Thousand/group separators are disabled entirely (e.g. 12345678 instead of 12,345,678)

@GDamyanov
GDamyanov deployed to netlify-preview October 19, 2026 08:15 — with GitHub Actions Active
@sap-ui5-webcomponents-release

Copy link
Copy Markdown

@GDamyanov
GDamyanov deployed to netlify-preview October 19, 2026 09:03 — with GitHub Actions Active
@GDamyanov GDamyanov changed the title feat(ui5-numeric-input, ui5-step-input): show extended numeric keyboard for mobile devices feat(ui5-numeric-input, ui5-step-input): use extended numeric keyboard and locale-independent formatting on mobile Oct 19, 2026
@GDamyanov GDamyanov self-assigned this Oct 19, 2026
@GDamyanov
GDamyanov marked this pull request as ready for review October 19, 2026 10:56
@GDamyanov
GDamyanov deployed to netlify-preview October 19, 2026 10:56 — with GitHub Actions Active
@github-actions

Copy link
Copy Markdown

👋 Heads-up: dev close is in effect

Thanks for the contribution! This repository is currently in dev close ahead of release 2.28 (scheduled 2026-10-21, UTC). See the release schedule for the full timeline.

This PR appears to introduce public-API changes (detected by diffing the Custom Elements Manifest against the latest published version on npm):

@ui5/webcomponents

  • ➕ added element: NumericInput
  • ➕ added property: accessibleName
  • ➕ added property: accessibleNameRef
  • ➕ added property: disabled
  • ➕ added property: max
  • ➕ added property: min
  • ➕ added property: name
  • ➕ added property: placeholder
  • ➕ added property: readonly
  • ➕ added property: step
  • ➕ added property: value
  • ➕ added property: valuePrecision
  • ➕ added property: valueState
  • ➕ added event: change
  • ➕ added event: input
  • ➕ added event: value-state-change
  • ➕ added slot: valueStateMessage
  • ➕ added attribute: accessible-name
  • ➕ added attribute: accessible-name-ref
  • ➕ added attribute: disabled
  • ➕ added attribute: max
  • ➕ added attribute: min
  • ➕ added attribute: name
  • ➕ added attribute: placeholder
  • ➕ added attribute: readonly
  • ➕ added attribute: step
  • ➕ added attribute: value
  • ➕ added attribute: value-precision
  • ➕ added attribute: value-state

Could you please hold off on merging into main until the release ships? Public-API changes are best landed in the next dev cycle so they don't slip into the release at the last minute. Once the release is out, this PR is good to go.

If this change must ship in the current release, please request a review from one or two members of @UI5/ui5-team-webc so the team can sign off explicitly.

💬 False positive? If you believe this PR doesn't actually change the public API (e.g. only internal refactoring, or an entry the detector mis-attributed), please reply on this thread — your feedback helps us improve the detection during this trial run.

Posted automatically by the Dev Close Notice workflow.

1 similar comment
@github-actions

Copy link
Copy Markdown

👋 Heads-up: dev close is in effect

Thanks for the contribution! This repository is currently in dev close ahead of release 2.28 (scheduled 2026-10-21, UTC). See the release schedule for the full timeline.

This PR appears to introduce public-API changes (detected by diffing the Custom Elements Manifest against the latest published version on npm):

@ui5/webcomponents

  • ➕ added element: NumericInput
  • ➕ added property: accessibleName
  • ➕ added property: accessibleNameRef
  • ➕ added property: disabled
  • ➕ added property: max
  • ➕ added property: min
  • ➕ added property: name
  • ➕ added property: placeholder
  • ➕ added property: readonly
  • ➕ added property: step
  • ➕ added property: value
  • ➕ added property: valuePrecision
  • ➕ added property: valueState
  • ➕ added event: change
  • ➕ added event: input
  • ➕ added event: value-state-change
  • ➕ added slot: valueStateMessage
  • ➕ added attribute: accessible-name
  • ➕ added attribute: accessible-name-ref
  • ➕ added attribute: disabled
  • ➕ added attribute: max
  • ➕ added attribute: min
  • ➕ added attribute: name
  • ➕ added attribute: placeholder
  • ➕ added attribute: readonly
  • ➕ added attribute: step
  • ➕ added attribute: value
  • ➕ added attribute: value-precision
  • ➕ added attribute: value-state

Could you please hold off on merging into main until the release ships? Public-API changes are best landed in the next dev cycle so they don't slip into the release at the last minute. Once the release is out, this PR is good to go.

If this change must ship in the current release, please request a review from one or two members of @UI5/ui5-team-webc so the team can sign off explicitly.

💬 False positive? If you believe this PR doesn't actually change the public API (e.g. only internal refactoring, or an entry the detector mis-attributed), please reply on this thread — your feedback helps us improve the detection during this trial run.

Posted automatically by the Dev Close Notice workflow.

@GDamyanov
GDamyanov requested a review from hinzzx October 20, 2026 11:01
@GDamyanov
GDamyanov deployed to netlify-preview October 22, 2026 06:52 — with GitHub Actions Active
this._formatter = NumberFormat.getFloatInstance({
decimals: this.valuePrecision,
...(!this._isDesktop && {
decimalSeparator: DEFAULT_DELIMITER,

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.

Here we should add also minusSign and plusSign in the overrides.

Because for example In our CLDR assets, there are few locales that don't use an ASCII - minus sign.

Such are: sv, fi, nb, et, hr, lt, sl.

In those locales user with value={-5} gets the string "−5". The HTML value sanitization rule for type="number" turns any invalid string into "", so the field renders empty.

Image

return this.formatter.parse(formattedValue) as number;
}

_syncValueFromInput() {

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.

This method is added to incSpin / decSpin and runs on every device, not only mobile. Is that expected ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is expected

return this.value.toString();
}

get _isDesktop() {

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.

This is checked in ~10 places. Most of them aren't needed.

  • Attaching the language-change handler only on desktop is incorrect. The mobile formatter still depends on the locale, so it must be rebuilt on language change. Keeping the original unconditional code is both simpler and correct.

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.

There is an AI Suggestion for simpler implementation:

## Simpler implementation

`_isDesktop` is checked in ~10 places. Most of them aren't needed:

- **The two `_isDesktop ? _removeGroupSeparators(...) : value` ternaries** (lines 646 and 684) do nothing on mobile. `groupSeparator` already returns `""` there, and `"…".replaceAll("", "")` returns the string unchanged. Calling `_removeGroupSeparators` unconditionally behaves identically.
- **Attaching the language-change handler only on desktop** (lines 429–440) is incorrect. The mobile formatter still depends on the locale (see the minus sign above), so it must be rebuilt on language change. Keeping the original unconditional code is both simpler and correct.
- **`if (preventDefault) e.preventDefault()` in the mobile branch of `_onkeydown`** (lines 777–783) is dead code. That branch is only reached for single-character keys, while `preventDefault` is only `true` for named keys (ArrowUp, Escape, …), which return earlier. A plain `return` is enough.
- **The `delimiter` getter writes `this._delimiter = "."` on every call on mobile.** A getter shouldn't have side effects; just `return ".";`.
- **The flag is named after the device rather than the reason.** The real constraint is "the native input is `type="number"`, so values must be in machine format". A single getter such as `_useNativeNumberInput` driving `type`, `formatter`, `delimiter`, `groupSeparator`, and the keydown early return keeps that reasoning in one place. `DEFAULT_DELIMITER` is also misleading — it's a forced value, not a default.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Mobile devices are not locale aware, since we use we use NumberFormat with . as decimal separator for all locales and disable of grouping so thausand separator is not available in mobile devices

This branch was successfully deployed

1 active deployment
netlify-preview — 00a02ad2 Deployed Oct 22, 2026 by GDamyanov via deploy-preview #3557
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants