wallet: show resource fee and balance in TxModal; add accessibility a… - #77
Merged
elizabetheonoja-art merged 1 commit intoJun 25, 2026
Conversation
elizabetheonoja-art
approved these changes
Jun 25, 2026
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.
Summary
Motivation
What this PR does
open,onClose,onConfirm,operation,resourceFee,balance.Escapeto close,role="dialog",aria-modal="true",aria-labelledbyand restores focus to previously focused element on close.Files changed
Implementation details (technical)
BigNumberfor robust decimal comparison: the insufficiency check runs inuseEffect:const fee = new BigNumber(resourceFee || "0");const bal = new BigNumber(balance || "0");setInsufficient(fee.isGreaterThan(bal));BigNumber(...).toFixed(7)with try/catch fallback to raw strings in case of invalid input.handleConfirmis wrapped inuseCallbackand setsconfirmingstate totrueduringonConfirm()until completion; on success it callsonClose()and always resetsconfirming.document.activeElementand focus the first focusable element inside the dialog (or the dialog itself).keydownhandler handlesEscapeto callonClose().Tabkey handling traps focus within the dialog (wraps to first/last).role="dialog",aria-modal="true",aria-labelledby="tx-modal-title", and the close button hasaria-label="Close dialog".animate-spin) is rendered in the confirm button duringconfirming.Testing performed
npm run testrm -rf node_modules package-lock.json && npm i) before test run.How to review / QA checklist
resourceFeeandbalanceprops and confirm modal renders operation, fee and balance.0.0123456 XLM).balance<resourceFee→ verify alert shows and confirm button is disabled.balance>=resourceFee→ click confirm → confirm button shows spinner andonConfirmis invoked; on success, dialog closes.Escapeto close the modal.role="dialog"andaria-modal="true"are present;aria-labelledbypoints to visible title.resourceFeeandbalanceas decimal strings (or numbers/string-convertible). Any invalid inputs gracefully fall back to display raw values.How to run locally
rm -rf node_modules package-lock.json && npm inpm run testnpm run devand exercise modal flows in UI.Backward compatibility & migration notes8
resourceFeeandbalance(strings). No breaking API changes beyond those props already indicated by the issue. If parents did not previously passresourceFee/balance, the modal will render0.0000000fallback values and continue to work.Potential follow-ups / improvement ideas
insufficientis true (CTA inside modal).TxModalbehavior (focus trap, insufficiency rendering, formatted output). If you want, I can add those tests in a follow-up.Security & performance
onConfirmremains the caller-provided async handler that performs signing/submission.Files to inspect
Closes #12