Skip to content

Commit

Permalink
fix: can't use the Tab button in the Mint Token form
Browse files Browse the repository at this point in the history
- manually setup the TAB focus chain; in the future, this should be done
properly on all new components using FocusScopes and similar

Fixes #13891
  • Loading branch information
caybro authored and jrainville committed Apr 4, 2024
1 parent 981b292 commit 78db1d0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ StackView {
pop(initialItem, StackView.Immediate)
}

// This method will be called from the outsite from a different section like Airdrop or Permissions
// This method will be called from the outside from a different section like Airdrop or Permissions
function openNewTokenForm(isAssetView) {
resetNavigation()

Expand Down Expand Up @@ -342,7 +342,7 @@ StackView {
Layout.preferredWidth: root.viewWidth
Layout.fillHeight: true

currentIndex: optionsTab.currentItem === collectiblesTab ? 0 : 1
currentIndex: optionsTab.currentIndex

CustomEditCommunityTokenView {
id: newCollectibleView
Expand Down
15 changes: 9 additions & 6 deletions ui/app/AppLayouts/Communities/views/EditCommunityTokenView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ StatusScrollView {
contentWidth: mainLayout.width
contentHeight: mainLayout.height

onVisibleChanged: if (visible) nameInput.forceActiveFocus()

ColumnLayout {
id: mainLayout

Expand All @@ -103,7 +105,6 @@ StatusScrollView {

StatusBaseText {
elide: Text.ElideRight
font.pixelSize: Theme.primaryTextFontSize
text: root.isAssetView ? qsTr("Icon") : qsTr("Artwork")
}

Expand Down Expand Up @@ -150,7 +151,7 @@ StatusScrollView {
}
extraValidator.errorMessage: d.containsAssetReferenceName ? qsTr("Asset name already exists") :
qsTr("You have used this token name before")

input.tabNavItem: descriptionInput
onTextChanged: root.token.name = text
}

Expand All @@ -170,7 +171,7 @@ StatusScrollView {
minLengthValidator.errorMessage: qsTr("Please enter a token description")
regexValidator.regularExpression: Constants.regularExpressions.ascii
regexValidator.errorMessage: qsTr("Only A-Z, 0-9 and standard punctuation allowed")

input.tabNavItem: symbolInput
onTextChanged: root.token.description = text
}

Expand All @@ -197,6 +198,7 @@ StatusScrollView {
return (!SQUtils.ModelUtils.contains(root.tokensModel, "symbol", symbolInput.text) && !d.containsAssetReferenceSymbol)
}
extraValidator.errorMessage: d.containsAssetReferenceSymbol ? qsTr("Symbol already exists") : qsTr("You have used this token symbol before")
input.tabNavItem: supplyInput.visible ? supplyInput : assetDecimalsInput

onTextChanged: {
const cursorPos = input.edit.cursorPosition
Expand All @@ -210,7 +212,6 @@ StatusScrollView {
StatusBaseText {
text: qsTr("Network")
color: Theme.palette.directColor1
font.pixelSize: Theme.primaryTextFontSize
}

Rectangle {
Expand Down Expand Up @@ -285,6 +286,7 @@ StatusScrollView {
regexValidator.regularExpression: Constants.regularExpressions.numerical
extraValidator.validate: function (value) { return parseInt(value) > 0 && parseInt(value) <= 999999999 }
extraValidator.errorMessage: qsTr("Enter a number between 1 and 999,999,999")
input.tabNavItem: assetDecimalsInput.visible ? assetDecimalsInput : previewButton

onTextChanged: {
const supplyNumber = parseInt(text)
Expand Down Expand Up @@ -333,6 +335,7 @@ StatusScrollView {
regexValidator.regularExpression: Constants.regularExpressions.numerical
extraValidator.validate: function (value) { return parseInt(value) > 0 && parseInt(value) <= 10 }
extraValidator.errorMessage: qsTr("Enter a number between 1 and 10")
input.tabNavItem: previewButton
onTextChanged: root.token.decimals = parseInt(text)
}

Expand Down Expand Up @@ -382,13 +385,15 @@ StatusScrollView {
}

StatusButton {
id: previewButton
Layout.preferredHeight: 44
Layout.alignment: Qt.AlignHCenter
Layout.fillWidth: true
Layout.topMargin: Style.current.padding
Layout.bottomMargin: Style.current.padding
text: qsTr("Preview")
enabled: d.isFullyFilled
highlighted: visualFocus

onClicked: root.previewClicked()
}
Expand Down Expand Up @@ -435,15 +440,13 @@ StatusScrollView {
StatusBaseText {
text: labelDescComponent.label
color: Theme.palette.directColor1
font.pixelSize: Theme.primaryTextFontSize
}

StatusBaseText {
Layout.fillWidth: true
Layout.fillHeight: true
text: labelDescComponent.description
color: Theme.palette.baseColor1
font.pixelSize: Theme.primaryTextFontSize
lineHeight: 1.2
wrapMode: Text.WordWrap
}
Expand Down

0 comments on commit 78db1d0

Please sign in to comment.