fix: give TransactionButton an accessible name while a transaction is in progress - #2676
Open
owenpkent wants to merge 1 commit into
Open
fix: give TransactionButton an accessible name while a transaction is in progress#2676owenpkent wants to merge 1 commit into
owenpkent wants to merge 1 commit into
Conversation
… in progress While a transaction is being signed or is pending, TransactionButton renders a bare Spinner and nothing else, so the disabled button has no accessible name (axe button-name, WCAG 4.1.2). Set aria-label="Transaction in progress" and aria-busy="true" for exactly the branch that shows the spinner, matching the wording CheckoutButton and TransactionToastLabel already use, and drop both again once the button shows "View transaction", "Try again" or the idle text. Fixes coinbase#2675
|
@owenpkent is attempting to deploy a commit to the Coinbase Team on Vercel. A member of the Team first needs to authorize it. |
🟡 Heimdall Review Status
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed? Why?
Fixes #2675.
TransactionButtonreplaces its label with a bare<Spinner />while a transaction is being signed or is pending.Spinnerrenders no text, so the<button>has no accessible name for the whole time it is disabled. axe-core reports it asbutton-name(WCAG 4.1.2), and a screen reader user who has just submitted a transaction is told nothing about the control they were on.This adds
aria-label="Transaction in progress"andaria-busy="true"to the button for exactly the branch that shows the spinner (no receipt, no error,isLoading). Both come off again as soon as the button reads "View transaction", "Try again" or the idle text, so the visible label stays the accessible name in every other state.The wording is the one the codebase already uses:
CheckoutButtonsetsaria-label={isLoading ? 'Transaction in progress' : buttonText}, andTransactionToastLabelshows "Transaction in progress" for the same state, so the button and the status line now say the same thing.The
renderprop path is unchanged. Custom renderers already receivestatusand own their own markup.Notes to reviewers
TransactionButton, which is what the issue reports. The same spinner swap happens inSwapButton,BuyButton,FundButton,NFTMintButton,ConnectWalletand the earn and send render buttons, and none of them set a name while loading. Happy to follow up on those separately if wanted.aria-busyis only rendered while pending rather than asaria-busy="false"the rest of the time, so the idle DOM is exactly as before.How has it been tested?
TransactionButton.test.tsx: the button is found by role with the name "Transaction in progress" and carriesaria-busy="true"while loading; the visible text is the name and neither attribute is present when idle; and the "View transaction" and "Try again" states are unaffected even withisLoadingstill true.pnpm f:ock test:coverage,pnpm f:ock lintand prettier all pass locally.button-name: 2 occurrences before (approving, pending), 0 after. Equal Accessinput_label_exists: 2 before, 0 after. No other finding changed, apart from two unrelatedcolor-contrasthits on the confirmed state's toast that did not recur on the second run.