divkit icon indicating copy to clipboard operation
divkit copied to clipboard

Fix Keyboard Type Handling by Adding Input Formatter for Number Input in Flutter DivKit

Open aliazimoshan opened this issue 1 year ago • 2 comments

In the web playground, when the keyboard_type is set to number in JSON, the client-side ensures that users can only input and paste numeric values. However, in the Flutter DivKit, setting the keyboard_type to number only displays the numeric keyboard, but users can still paste or type non-numeric strings. This behavior is inconsistent with the web version, where non-numeric inputs are restricted.

Changes Introduced:

  • Added an inputFormatter to DivInput in Flutter DivKit.
  • The inputFormatter is set to digitsOnly when keyboard_type is number, ensuring users can only input numeric values.
  • For all other keyboard_type values, the inputFormatter is set to none, allowing normal string input.

Impact:

  • Ensures consistency between the web and Flutter versions regarding input behavior for numeric fields.
  • Prevents users from inputting or pasting non-numeric values when keyboard_type is number in Flutter DivKit.

Testing:

  • Verified that when keyboard_type is set to number, users can only input numeric values.
  • Confirmed that for other keyboard_type values, normal string input is allowed.

aliazimoshan avatar Jul 13 '24 20:07 aliazimoshan

The branch has a conflict and an incorrect diff. Please make a diff that includes only changes that add functionality

MANA-Y avatar Aug 23 '24 09:08 MANA-Y

And check out the terms of the CLA available at: https://yandex.ru/legal/cla/?lang=en

MANA-Y avatar Aug 23 '24 09:08 MANA-Y

Nothing happens here, conflicts are not resolved yet.

lunarstill avatar Nov 14 '24 08:11 lunarstill