Success Criterion 3.3.4 - Level AA
Error Prevention (Legal, Financial, Data)
Ensure users submit data intentionally. Allows users to undo, correct or confirm a submission. Provide at least one of these options for submissions that cause a legal obligation, financial transaction, or loss of data.
Impact
Everyone benefits from preventing unforeseen consequences.
Confirming submissions is important for users of assistive technologies because they are more likely make mistakes when entering data.
Check
“Is confirmation requested before submissions are final?“
This can be tested without assistive technologies.
Solution
Use a dialog for confirmation
On Android, you can show a dialog by using AlertDialog
, BottomSheetDialog
or DialogFragment
. You should always add a close button by using the setNegativeButton
method. The focus of assistive technologies is automatically trapped inside the dialog while it's visible.
val builder = AlertDialog.Builder(this)
builder.setTitle("Confirm Appt membership?")
builder.setMessage("Your bank account will be billed.")
builder.setPositiveButton("Proceed") { dialog, which ->
// Proceed
}
builder.setNegativeButton("Cancel") { dialog, which ->
// Cancel
}
builder.show()