From 11f7ae140584c6b9756394ebb926da93093e49a1 Mon Sep 17 00:00:00 2001 From: Roman Chornii Date: Wed, 29 May 2024 20:59:49 +0300 Subject: [PATCH] fix: Error message is misleading when pasting bio longer than 240 chars (#14881) de-synchronized charLimit and input.maximumLength for Profile Description bio properties to get the UX identical to mobile. Fixes: #14879 --- .../Profile/panels/ProfileDescriptionPanel.qml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ui/app/AppLayouts/Profile/panels/ProfileDescriptionPanel.qml b/ui/app/AppLayouts/Profile/panels/ProfileDescriptionPanel.qml index 4c683f3ea7..3867b7b2ae 100644 --- a/ui/app/AppLayouts/Profile/panels/ProfileDescriptionPanel.qml +++ b/ui/app/AppLayouts/Profile/panels/ProfileDescriptionPanel.qml @@ -48,15 +48,24 @@ Item { label: qsTr("Bio") placeholderText: qsTr("Tell us about yourself") + input.maximumLength : 32767 charLimit: 240 multiline: true minimumHeight: 108 maximumHeight: 108 input.verticalAlignment: TextEdit.AlignTop validators: [ + StatusValidator { + name: "maxLengthValidator" + validate: function (t) { return t.length <= bioInput.charLimit} + errorMessage: qsTr("Bio can’t be longer than %n character(s)", "", bioInput.charLimit) + }, StatusRegularExpressionValidator { regularExpression: Constants.regularExpressions.asciiWithEmoji errorMessage: qsTr("Invalid characters. Standard keyboard characters and emojis only.") + validate: function (value) { + return (regularExpression.test(value) || (value.length === 0)); + } } ] input.tabNavItem: displayNameInput.input.edit