diff --git a/src/controls/Private/qquickspinboxvalidator.cpp b/src/controls/Private/qquickspinboxvalidator.cpp
index afbc866c887ae01fbfb935f04e7776a474fcef7a..2fec79e826c941959e42bb5282eddbcafd1d86be 100644
--- a/src/controls/Private/qquickspinboxvalidator.cpp
+++ b/src/controls/Private/qquickspinboxvalidator.cpp
@@ -200,7 +200,9 @@ QValidator::State QQuickSpinBoxValidator::validate(QString &input, int &pos) con
         bool ok = false;
         qreal val = locale().toDouble(value, &ok);
         if (ok) {
-            if (state == QValidator::Acceptable) {
+            if (state == QValidator::Acceptable ||
+               (state == QValidator::Intermediate && val >= 0 && val <= m_validator.top()) ||
+               (state == QValidator::Intermediate && val < 0 && val >= m_validator.bottom())) {
                 const_cast<QQuickSpinBoxValidator *>(this)->setValue(val);
                 if (input != textFromValue(val))
                     state = QValidator::Intermediate;
diff --git a/tests/auto/controls/data/tst_spinbox.qml b/tests/auto/controls/data/tst_spinbox.qml
index f74386c94d7553c00ef7040951b962d244ede964..71132ca9fdbd10c8fc5e38e0b782859e03c01bc6 100644
--- a/tests/auto/controls/data/tst_spinbox.qml
+++ b/tests/auto/controls/data/tst_spinbox.qml
@@ -132,7 +132,10 @@ Item {
                 {tag: "-20", input: [Qt.Key_Minus, Qt.Key_2, Qt.Key_0, Qt.Key_Return], value: -2, minimumValue: -10},
                 {tag: "-200", input: [Qt.Key_Minus, Qt.Key_2, Qt.Key_0, Qt.Key_0, Qt.Key_Return], value: -20, minimumValue: -100},
                 {tag: "-2000", input: [Qt.Key_Minus, Qt.Key_2, Qt.Key_0, Qt.Key_0, Qt.Key_0, Qt.Key_Return], value: -200, minimumValue: -1000},
-                {tag: "-0123", input: [Qt.Key_Minus, Qt.Key_0, Qt.Key_1, Qt.Key_2, Qt.Key_3, Qt.Key_Return], value: -123, minimumValue: -150}
+                {tag: "-0123", input: [Qt.Key_Minus, Qt.Key_0, Qt.Key_1, Qt.Key_2, Qt.Key_3, Qt.Key_Return], value: -123, minimumValue: -150},
+
+                {tag: "5", input: [Qt.Key_2, Qt.Key_0, Qt.Key_Return], value: 20, minimumValue: 10, maximumValue: 99},
+                {tag: "-5", input: [Qt.Key_Minus, Qt.Key_2, Qt.Key_0, Qt.Key_Return], value: -20, minimumValue: -99, maximumValue: -10},
             ]
         }