From 4530923a500f0bbbb1864da73efe737eacdd1ace Mon Sep 17 00:00:00 2001 From: qiuguohua Date: Fri, 3 Jan 2025 16:51:21 +0800 Subject: [PATCH] Fix the problem of incorrect decimal point input when editbox input type is number (#18118) Co-authored-by: qiuguohua --- cocos/ui/editbox/edit-box-impl.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cocos/ui/editbox/edit-box-impl.ts b/cocos/ui/editbox/edit-box-impl.ts index 070efeb1ad..9b976c137b 100644 --- a/cocos/ui/editbox/edit-box-impl.ts +++ b/cocos/ui/editbox/edit-box-impl.ts @@ -646,7 +646,7 @@ export class EditBoxImpl extends EditBoxImplBase { const delegate = this._delegate; // input of number type doesn't support maxLength attribute const maxLength = delegate!.maxLength; - if (maxLength >= 0) { + if (maxLength >= 0 && elem.type !== 'number') { elem.value = elem.value.slice(0, maxLength); } delegate!._editBoxTextChanged(elem.value);