Skip to content

Commit 39da035

Browse files
Merge pull request #109 from mxenabled/aw/CT-1436
aw/CT-1436
2 parents edc7239 + 1b991db commit 39da035

File tree

3 files changed

+25
-3
lines changed

3 files changed

+25
-3
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## v.0.13.1
4+
5+
- Fixed accessibility issue with the verify deposits view
6+
37
## v.0.13.0
48

59
- Added a way to override event data for some events based on the member

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@mxenabled/connect-widget",
33
"description": "A simple ui library for React",
4-
"version": "0.13.0",
4+
"version": "0.13.1",
55
"module": "dist/index.es.js",
66
"types": "dist/index.d.ts",
77
"type": "module",

src/views/microdeposits/VerifyDeposits.js

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ const reducer = (state, action) => {
3838

3939
export const VerifyDeposits = ({ microdeposit, onSuccess }) => {
4040
const containerRef = useRef(null)
41+
const firstInputRef = useRef(null)
42+
const secondInputRef = useRef(null)
4143
useAnalyticsPath(...PageviewInfo.CONNECT_MICRODEPOSITS_VERIFY_DEPOSITS)
4244
const { api } = useApi()
4345
const initialForm = { firstAmount: '', secondAmount: '' }
@@ -84,6 +86,14 @@ export const VerifyDeposits = ({ microdeposit, onSuccess }) => {
8486
return () => subscription.unsubscribe()
8587
}, [state.isSubmitting])
8688

89+
useEffect(() => {
90+
if (errors.firstAmount) {
91+
firstInputRef.current.focus()
92+
} else if (errors.secondAmount) {
93+
secondInputRef.current.focus()
94+
}
95+
}, [errors])
96+
8797
return (
8898
<div ref={containerRef}>
8999
<SlideDown>
@@ -134,7 +144,11 @@ export const VerifyDeposits = ({ microdeposit, onSuccess }) => {
134144
error={!!errors.firstAmount}
135145
helperText={errors.firstAmount}
136146
id={schema.firstAmount.label}
137-
inputProps={{ 'data-test': 'amount-1-input' }}
147+
inputProps={{
148+
'data-test': 'amount-1-input',
149+
'aria-describedby': errors.firstAmount ? 'firstAmount-error' : undefined,
150+
}}
151+
inputRef={firstInputRef}
138152
label={schema.firstAmount.label}
139153
name="firstAmount"
140154
onChange={handleTextInputChange}
@@ -149,7 +163,11 @@ export const VerifyDeposits = ({ microdeposit, onSuccess }) => {
149163
error={!!errors.secondAmount}
150164
helperText={errors.secondAmount}
151165
id={schema.secondAmount.label}
152-
inputProps={{ 'data-test': 'amount-2-input' }}
166+
inputProps={{
167+
'data-test': 'amount-2-input',
168+
'aria-describedby': errors.secondAmount ? 'secondAmount-error' : undefined,
169+
}}
170+
inputRef={secondInputRef}
153171
label={schema.secondAmount.label}
154172
name="secondAmount"
155173
onChange={handleTextInputChange}

0 commit comments

Comments
 (0)