From 07e015e86e2a73c248b4055685efceaad0530c8b Mon Sep 17 00:00:00 2001 From: "Ahmad K. Bawaneh" Date: Thu, 19 Dec 2024 21:05:01 +0300 Subject: [PATCH] fix #990 Number Boxes dont allow backspace --- .../org/dominokit/domino/ui/forms/NumberBox.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/domino-ui/src/main/java/org/dominokit/domino/ui/forms/NumberBox.java b/domino-ui/src/main/java/org/dominokit/domino/ui/forms/NumberBox.java index b80cf2ca2..3cbd35ab6 100644 --- a/domino-ui/src/main/java/org/dominokit/domino/ui/forms/NumberBox.java +++ b/domino-ui/src/main/java/org/dominokit/domino/ui/forms/NumberBox.java @@ -31,7 +31,16 @@ import org.dominokit.domino.ui.events.EventType; import org.dominokit.domino.ui.forms.validations.InputAutoValidator; import org.dominokit.domino.ui.forms.validations.ValidationResult; -import org.dominokit.domino.ui.utils.*; +import org.dominokit.domino.ui.utils.ApplyFunction; +import org.dominokit.domino.ui.utils.DominoElement; +import org.dominokit.domino.ui.utils.HasMinMaxValue; +import org.dominokit.domino.ui.utils.HasPlaceHolder; +import org.dominokit.domino.ui.utils.HasPostfix; +import org.dominokit.domino.ui.utils.HasPrefix; +import org.dominokit.domino.ui.utils.HasStep; +import org.dominokit.domino.ui.utils.LazyChild; +import org.dominokit.domino.ui.utils.PostfixElement; +import org.dominokit.domino.ui.utils.PrefixElement; import org.gwtproject.i18n.client.NumberFormat; import org.gwtproject.i18n.shared.cldr.LocaleInfo; import org.gwtproject.i18n.shared.cldr.NumberConstants; @@ -211,7 +220,9 @@ protected String createKeyMatch() { */ protected void onKeyDown(Event event) { KeyboardEvent keyboardEvent = Js.uncheckedCast(event); - if (!keyboardEvent.key.matches(createKeyMatch())) event.preventDefault(); + if (keyboardEvent.key.length() == 1 && !keyboardEvent.key.matches(createKeyMatch())) { + event.preventDefault(); + } } /**