taler-android

Android apps for GNU Taler (wallet, PoS, cashier)
Log | Files | Refs | README | LICENSE

action-buttons-have-no-accessible-name.diff (3372B)


      1 diff --git a/wallet/src/main/java/net/taler/wallet/compose/ActionButton.kt b/wallet/src/main/java/net/taler/wallet/compose/ActionButton.kt
      2 index 86f3786e..3c0db806 100644
      3 --- a/wallet/src/main/java/net/taler/wallet/compose/ActionButton.kt
      4 +++ b/wallet/src/main/java/net/taler/wallet/compose/ActionButton.kt
      5 @@ -29,6 +29,7 @@ import androidx.compose.ui.Alignment
      6  import androidx.compose.ui.Modifier
      7  import androidx.compose.ui.graphics.Color
      8  import androidx.compose.ui.graphics.Shape
      9 +import androidx.compose.ui.semantics.semantics
     10  import androidx.compose.ui.text.style.TextAlign
     11  import androidx.compose.ui.unit.dp
     12  
     13 @@ -44,7 +45,15 @@ fun ActionButton(
     14      labelColor: Color = MaterialTheme.colorScheme.onPrimaryContainer,
     15      enabled: Boolean = true,
     16  ) {
     17 -    Column(modifier, horizontalAlignment = Alignment.CenterHorizontally) {
     18 +    // One accessibility node for the icon and its label together: the icon
     19 +    // carries no description (right for decoration, but it is the only thing
     20 +    // inside the button), so without this the control is announced as
     21 +    // "Button" with no name, and the label is a separate focus stop.  Merging
     22 +    // here fixes every caller at once, and makes the whole column the target.
     23 +    Column(
     24 +        modifier.semantics(mergeDescendants = true) {},
     25 +        horizontalAlignment = Alignment.CenterHorizontally,
     26 +    ) {
     27          FloatingActionButton(
     28              onClick = if (enabled) onClick else {{}},
     29              shape = shape,
     30 diff --git a/wallet/src/main/java/net/taler/wallet/transactions/TransactionsScreen.kt b/wallet/src/main/java/net/taler/wallet/transactions/TransactionsScreen.kt
     31 index a08133df..ff9e4d8d 100644
     32 --- a/wallet/src/main/java/net/taler/wallet/transactions/TransactionsScreen.kt
     33 +++ b/wallet/src/main/java/net/taler/wallet/transactions/TransactionsScreen.kt
     34 @@ -116,7 +116,14 @@ fun TransactionsScreen(
     35                  }) {
     36                      Icon(
     37                          imageVector = Icons.Rounded.Close,
     38 -                        contentDescription = null,
     39 +                        // The only way out of selection mode, and the only
     40 +                        // thing in the button: without a description it is
     41 +                        // announced as an unnamed button, and a screen reader
     42 +                        // user has no way to tell it from the back arrow it
     43 +                        // replaces.
     44 +                        contentDescription = stringResource(
     45 +                            R.string.transactions_leave_selection,
     46 +                        ),
     47                      )
     48                  }
     49              }
     50 diff --git a/wallet/src/main/res/values/strings.xml b/wallet/src/main/res/values/strings.xml
     51 index 905e4390..219246b9 100644
     52 --- a/wallet/src/main/res/values/strings.xml
     53 +++ b/wallet/src/main/res/values/strings.xml
     54 @@ -227,6 +227,7 @@ GNU Taler is immune to many types of fraud such as credit card data theft, phish
     55      <string name="transactions_retry">Retry</string>
     56      <string name="transactions_required_kyc">KYC required to proceed</string>
     57      <string name="transactions_select_all">Select All</string>
     58 +    <string name="transactions_leave_selection">Leave selection mode</string>
     59      <string name="transactions_send_funds">Send</string>
     60      <string name="transactions_suspend">Suspend</string>
     61      <string name="transactions_title">Transactions</string>