[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-taler-ios] 185/204: A11y textfield label
From: |
gnunet |
Subject: |
[taler-taler-ios] 185/204: A11y textfield label |
Date: |
Thu, 05 Dec 2024 23:52:33 +0100 |
This is an automated email from the git hooks/post-receive script.
marc-stibane pushed a commit to branch master
in repository taler-ios.
commit f3e6874b0563dc10862cc40387dfd61ff326e9a5
Author: Marc Stibane <marc@taler.net>
AuthorDate: Wed Dec 4 07:08:31 2024 +0100
A11y textfield label
---
.../Views/Actions/Banking/DepositAmountView.swift | 7 +++++--
TalerWallet1/Views/Actions/Banking/ManualWithdraw.swift | 7 +++++--
.../Views/Actions/Peer2peer/RequestPayment.swift | 5 +++--
.../Views/Actions/Peer2peer/SendAmountView.swift | 2 ++
TalerWallet1/Views/HelperViews/AmountInputV.swift | 2 ++
TalerWallet1/Views/HelperViews/CurrencyInputView.swift | 17 +++++++++++------
TalerWallet1/Views/HelperViews/ScopePicker.swift | 12 +++++++++---
TalerWallet1/Views/Sheets/Payment/PayTemplateV.swift | 4 +++-
.../Sheets/WithdrawBankIntegrated/WithdrawURIView.swift | 4 +++-
9 files changed, 43 insertions(+), 17 deletions(-)
diff --git a/TalerWallet1/Views/Actions/Banking/DepositAmountView.swift
b/TalerWallet1/Views/Actions/Banking/DepositAmountView.swift
index 0a21e46..e74ac63 100644
--- a/TalerWallet1/Views/Actions/Banking/DepositAmountView.swift
+++ b/TalerWallet1/Views/Actions/Banking/DepositAmountView.swift
@@ -136,12 +136,15 @@ struct DepositAmountView: View {
Text("Available:\t\(availableStr)")
.talerFont(.title3)
.padding(.bottom, 2)
+ let a11yLabel = String(localized: "Amount to deposit:",
comment: "accessibility, no abbreviations")
+ let amountLabel = minimalistic ? String(localized: "Amount:")
+ : a11yLabel
CurrencyInputView(scope: scopeInfo,
amount: $amountToTransfer,
amountLastUsed: amountLastUsed,
available: nil, // amountAvailable,
- title: minimalistic ? String(localized:
"Amount:")
- : String(localized:
"Amount to deposit:"),
+ title: amountLabel,
+ a11yTitle: a11yLabel,
shortcutAction: nil)
.padding(.horizontal)
diff --git a/TalerWallet1/Views/Actions/Banking/ManualWithdraw.swift
b/TalerWallet1/Views/Actions/Banking/ManualWithdraw.swift
index dab2cd3..db888f7 100644
--- a/TalerWallet1/Views/Actions/Banking/ManualWithdraw.swift
+++ b/TalerWallet1/Views/Actions/Banking/ManualWithdraw.swift
@@ -209,12 +209,15 @@ struct ManualWithdrawContent: View {
let tosAccepted = (exchange?.tosStatus == .accepted) ?? false
if tosAccepted {
+ let a11yLabel = String(localized: "Amount to withdraw:",
comment: "accessibility, no abbreviations")
+ let amountLabel = minimalistic ? String(localized:
"Amount:")
+ : a11yLabel
CurrencyInputView(scope: scope,
amount: $amountToTransfer,
amountLastUsed: amountLastUsed,
available: nil,
- title: minimalistic ? String(localized:
"Amount:")
- : String(localized:
"Amount to withdraw:"),
+ title: amountLabel,
+ a11yTitle: a11yLabel,
shortcutAction: nil)
.padding(.top)
.task(id: amountToTransfer.value) { // re-run this
whenever amountToTransfer changes
diff --git a/TalerWallet1/Views/Actions/Peer2peer/RequestPayment.swift
b/TalerWallet1/Views/Actions/Peer2peer/RequestPayment.swift
index cf38e96..0fbdea5 100644
--- a/TalerWallet1/Views/Actions/Peer2peer/RequestPayment.swift
+++ b/TalerWallet1/Views/Actions/Peer2peer/RequestPayment.swift
@@ -251,13 +251,14 @@ struct RequestPaymentContent: View {
}
let tosAccepted = (exchange?.tosStatus == .accepted) ?? false
if tosAccepted {
+ let a11yLabel = String(localized: "Amount to request:",
comment: "accessibility, no abbreviations")
let amountLabel = minimalistic ? String(localized:
"Amount:")
- : String(localized: "Amount
to request:")
-// Text(amountLabel)
+ : a11yLabel
AmountInputV(stack: stack.push(),
scope: balance.scopeInfo,
amountAvailable: $amountZero, // incoming needs
no available
amountLabel: amountLabel,
+ a11yLabel: a11yLabel,
amountToTransfer: $amountToTransfer,
amountLastUsed: amountLastUsed,
wireFee: nil,
diff --git a/TalerWallet1/Views/Actions/Peer2peer/SendAmountView.swift
b/TalerWallet1/Views/Actions/Peer2peer/SendAmountView.swift
index a68edfc..897e0b1 100644
--- a/TalerWallet1/Views/Actions/Peer2peer/SendAmountView.swift
+++ b/TalerWallet1/Views/Actions/Peer2peer/SendAmountView.swift
@@ -160,10 +160,12 @@ struct SendAmountView: View {
NavLink($buttonSelected) { inputDestination }
NavLink($shortcutSelected) { shortcutDestination }
}
+ let a11yLabel = String(localized: "Amount to send:", comment:
"accessibility, no abbreviations")
AmountInputV(stack: stack.push(),
scope: balance.scopeInfo,
amountAvailable: $amountAvailable,
amountLabel: nil, // will use "Available for
transfer: xxx", trailing
+ a11yLabel: a11yLabel,
amountToTransfer: $amountToTransfer,
amountLastUsed: amountLastUsed,
wireFee: nil,
diff --git a/TalerWallet1/Views/HelperViews/AmountInputV.swift
b/TalerWallet1/Views/HelperViews/AmountInputV.swift
index b9afaa3..85a4794 100644
--- a/TalerWallet1/Views/HelperViews/AmountInputV.swift
+++ b/TalerWallet1/Views/HelperViews/AmountInputV.swift
@@ -35,6 +35,7 @@ struct AmountInputV: View {
let scope: ScopeInfo?
@Binding var amountAvailable: Amount
let amountLabel: String?
+ let a11yLabel: String
@Binding var amountToTransfer: Amount
let amountLastUsed: Amount
let wireFee: Amount?
@@ -92,6 +93,7 @@ struct AmountInputV: View {
amountLastUsed: amountLastUsed,
available: amountAvailable,
title: amountLabel,
+ a11yTitle: a11yLabel,
shortcutAction: shortcutAction)
// .accessibility(sortPriority: 2)
diff --git a/TalerWallet1/Views/HelperViews/CurrencyInputView.swift
b/TalerWallet1/Views/HelperViews/CurrencyInputView.swift
index 7fa92e7..698c874 100644
--- a/TalerWallet1/Views/HelperViews/CurrencyInputView.swift
+++ b/TalerWallet1/Views/HelperViews/CurrencyInputView.swift
@@ -66,6 +66,7 @@ struct CurrencyInputView: View {
let amountLastUsed: Amount
let available: Amount?
let title: String?
+ let a11yTitle: String
let shortcutAction: ((_ amount: Amount) -> Void)?
@EnvironmentObject private var controller: Controller
@@ -114,20 +115,23 @@ struct CurrencyInputView: View {
return buttons
}
+ func availableString(_ availableStr: String) -> String {
+ String(localized: "Available for transfer: \(availableStr)")
+ }
+
+ var a11yLabel: String { // format currency for a11y
+ availableString(available?.readableDescription ?? String(localized:
"unknown"))
+ }
+
func heading() -> String? {
if let title {
return title
}
if let available {
- let availableStr = available.formatted(scope, isNegative: false)
- return String(localized: "Available for transfer: \(availableStr)")
+ return availableString(available.formatted(scope, isNegative:
false))
}
return nil
}
- var a11yLabel: String { // format currency for a11y
- let availableStr = available?.readableDescription ?? String(localized:
"unknown")
- return String(localized: "Available: \(availableStr)")
- }
func currencyInfo() -> CurrencyInfo {
if let scope {
@@ -158,6 +162,7 @@ struct CurrencyInputView: View {
.padding(.bottom, -6)
}
currencyField
+ .accessibilityLabel(a11yTitle)
.frame(maxWidth: .infinity, alignment: .trailing)
.foregroundColor(WalletColors().fieldForeground) // text
color
// .background(WalletColors().fieldBackground) //
problem: white corners
diff --git a/TalerWallet1/Views/HelperViews/ScopePicker.swift
b/TalerWallet1/Views/HelperViews/ScopePicker.swift
index d4d529c..f67fed9 100644
--- a/TalerWallet1/Views/HelperViews/ScopePicker.swift
+++ b/TalerWallet1/Views/HelperViews/ScopePicker.swift
@@ -42,7 +42,7 @@ struct ScopePicker: View {
let available = balance.available
let availableA11y = available.formatted(currencyInfo, isNegative:
false, useISO: true, a11y: ".")
let url = balance.scopeInfo.url?.trimURL ?? EMPTYSTRING
- let a11yLabel = url + ", " + availableA11y
+// let a11yLabel = url + ", " + availableA11y
HStack(alignment: .firstTextBaseline) {
let disabled = (count == 1)
@@ -68,11 +68,12 @@ struct ScopePicker: View {
.frame(maxWidth: .infinity)
// .border(.red) // debugging
.pickerStyle(.menu)
+// .accessibilityLabel(a11yLabel)
.labelsHidden() // be sure to use valid
labels for a11y
}
}
.talerFont(.picker)
- .accessibilityLabel(a11yLabel)
+// .accessibilityLabel(a11yLabel)
.accessibilityHint(String(localized: "Choose the payment
service.", comment: "a11y"))
.task() {
withAnimation { selected = value }
@@ -105,10 +106,13 @@ struct ScopeDropDown: View {
@ViewBuilder
func dropDownRow(_ balance: Balance, _ currencyInfo: CurrencyInfo, _
first: Bool = false) -> some View {
- let text = Text(urlOrCurrency(balance))
+ let urlOrCurrency = urlOrCurrency(balance)
+ let text = Text(urlOrCurrency)
let amount = Text(formattedAmount(balance, currencyInfo).nbs)
+ let a11yAmount = balance.available.readableDescription
if first {
text
+ .accessibilityLabel("via \(urlOrCurrency)")
} else {
let hLayout = HStack(alignment: .firstTextBaseline) {
text
@@ -127,6 +131,8 @@ struct ScopeDropDown: View {
hLayout
vLayout
}
+ .accessibilityElement(children: .combine)
+ .accessibilityLabel("\(urlOrCurrency), \(a11yAmount)")
}
}
diff --git a/TalerWallet1/Views/Sheets/Payment/PayTemplateV.swift
b/TalerWallet1/Views/Sheets/Payment/PayTemplateV.swift
index 8baee26..7c7d8e7 100644
--- a/TalerWallet1/Views/Sheets/Payment/PayTemplateV.swift
+++ b/TalerWallet1/Views/Sheets/Payment/PayTemplateV.swift
@@ -129,8 +129,9 @@ struct PayTemplateV: View {
var body: some View {
if let templateContract { // preparePayResult
// let currency = templateContract.currency ??
templateContract.amount?.currencyStr ?? UNKNOWN
+ let a11yLabel = String(localized: "Amount to pay:", comment:
"accessibility, no abbreviations")
let amountLabel = minimalistic ? String(localized: "Amount:")
- : String(localized: "Amount to
pay:")
+ : a11yLabel
// final destination with amountToTransfer, after user input of
amount
let finalDestinationI = PaymentView(stack: stack.push(),
url: url,
@@ -178,6 +179,7 @@ struct PayTemplateV: View {
scope: scope,
amountAvailable: $amountAvailable,
amountLabel: amountLabel,
+ a11yLabel: a11yLabel,
amountToTransfer: $amountToTransfer,
amountLastUsed: amountLastUsed,
wireFee: nil,
diff --git
a/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawURIView.swift
b/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawURIView.swift
index 59ff05b..3af6b79 100755
--- a/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawURIView.swift
+++ b/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawURIView.swift
@@ -160,13 +160,15 @@ struct WithdrawURIView: View {
NavLink($shortcutSelected) { shortcutDest }
NavLink($buttonSelected) { acceptDestination }
}
+ let a11yLabel = String(localized: "Amount to
withdraw:", comment: "accessibility, no abbreviations")
let amountLabel = minimalistic ? String(localized:
"Amount:") // maxAmount
- : String(localized:
"Amount to withdraw:")
+ : a11yLabel
// TODO: input amount, then
AmountInputV(stack: stack.push(),
scope: exchange.scopeInfo,
amountAvailable: $amountZero,
amountLabel: amountZero.isZero ?
amountLabel : nil,
+ a11yLabel: a11yLabel,
amountToTransfer: $amountToTransfer,
amountLastUsed: amountLastUsed,
wireFee: wireFee,
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-taler-ios] 198/204: BankEditView, (continued)
- [taler-taler-ios] 198/204: BankEditView, gnunet, 2024/12/05
- [taler-taler-ios] 164/204: amountLabel, gnunet, 2024/12/05
- [taler-taler-ios] 171/204: translations for GNU Taler, gnunet, 2024/12/05
- [taler-taler-ios] 175/204: layout, gnunet, 2024/12/05
- [taler-taler-ios] 177/204: common.scopes.first, gnunet, 2024/12/05
- [taler-taler-ios] 183/204: Section header, gnunet, 2024/12/05
- [taler-taler-ios] 193/204: Sound, gnunet, 2024/12/05
- [taler-taler-ios] 195/204: DepositWireTypes, gnunet, 2024/12/05
- [taler-taler-ios] 167/204: badge + a11y, gnunet, 2024/12/05
- [taler-taler-ios] 166/204: BankListView, gnunet, 2024/12/05
- [taler-taler-ios] 185/204: A11y textfield label,
gnunet <=
- [taler-taler-ios] 187/204: A11y, gnunet, 2024/12/05
- [taler-taler-ios] 186/204: bounce, gnunet, 2024/12/05
- [taler-taler-ios] 204/204: Bump version to 0.14.0 (0.13.14), gnunet, 2024/12/05
- [taler-taler-ios] 197/204: L10n, gnunet, 2024/12/05
- [taler-taler-ios] 201/204: pop-to-root on second tap, gnunet, 2024/12/05
- [taler-taler-ios] 200/204: reloadTransactions, gnunet, 2024/12/05
- [taler-taler-ios] 202/204: bank accounts - w.i.p., gnunet, 2024/12/05
- [taler-taler-ios] 199/204: A11y as tupel, gnunet, 2024/12/05
- [taler-taler-ios] 203/204: German localization, gnunet, 2024/12/05