Skip to content

Commit 6851c5a

Browse files
committed
Adds accessibility labels
1 parent ead0e9e commit 6851c5a

File tree

2 files changed

+70
-6
lines changed

2 files changed

+70
-6
lines changed

packages/core/src/js/feedback/FeedbackWidget.tsx

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -230,19 +230,21 @@ export class FeedbackWidget extends React.Component<FeedbackWidgetProps, Feedbac
230230
source={{ uri: sentryLogo }}
231231
style={styles.sentryLogo}
232232
testID='sentry-logo'
233+
accessibilityLabel='Sentry logo'
233234
/>
234235
)}
235236
</View>
236237

237238
{config.showName && (
238239
<>
239-
<Text style={styles.label} testID='name-label'>
240+
<Text style={styles.label} testID='name-label' accessibilityLabel={text.nameLabel}>
240241
{text.nameLabel}
241242
{config.isNameRequired && ` ${text.isRequiredLabel}`}
242243
</Text>
243244
<TextInput
244245
style={styles.input}
245246
testID='name-input'
247+
accessibilityLabel={text.namePlaceholder}
246248
placeholder={text.namePlaceholder}
247249
value={name}
248250
onChangeText={(value) => this.setState({ name: value })}
@@ -252,13 +254,14 @@ export class FeedbackWidget extends React.Component<FeedbackWidgetProps, Feedbac
252254

253255
{config.showEmail && (
254256
<>
255-
<Text style={styles.label} testID='email-label'>
257+
<Text style={styles.label} testID='email-label' accessibilityLabel={text.emailLabel}>
256258
{text.emailLabel}
257259
{config.isEmailRequired && ` ${text.isRequiredLabel}`}
258260
</Text>
259261
<TextInput
260262
style={styles.input}
261263
testID='email-input'
264+
accessibilityLabel={text.emailPlaceholder}
262265
placeholder={text.emailPlaceholder}
263266
keyboardType={'email-address' as KeyboardTypeOptions}
264267
value={email}
@@ -267,13 +270,14 @@ export class FeedbackWidget extends React.Component<FeedbackWidgetProps, Feedbac
267270
</>
268271
)}
269272

270-
<Text style={styles.label} testID='message-label'>
273+
<Text style={styles.label} testID='message-label' accessibilityLabel={text.messageLabel}>
271274
{text.messageLabel}
272275
{` ${text.isRequiredLabel}`}
273276
</Text>
274277
<TextInput
275278
style={[styles.input, styles.textArea]}
276279
testID='message-input'
280+
accessibilityLabel={text.messagePlaceholder}
277281
placeholder={text.messagePlaceholder}
278282
value={description}
279283
onChangeText={(value) => this.setState({ description: value })}
@@ -286,10 +290,13 @@ export class FeedbackWidget extends React.Component<FeedbackWidgetProps, Feedbac
286290
source={{ uri: this.state.attachmentUri }}
287291
style={styles.screenshotThumbnail}
288292
testID='screenshot-thumbnail'
293+
accessibilityLabel='Screenshot thumbnail'
289294
/>
290295
)}
291296
<TouchableOpacity style={styles.screenshotButton} onPress={this.onScreenshotButtonPress}>
292-
<Text style={styles.screenshotText} testID='screenshot-button'>
297+
<Text style={styles.screenshotText} testID='screenshot-button' accessibilityLabel={!this.state.filename && !this.state.attachment
298+
? text.addScreenshotButtonLabel
299+
: text.removeScreenshotButtonLabel}>
293300
{!this.state.filename && !this.state.attachment
294301
? text.addScreenshotButtonLabel
295302
: text.removeScreenshotButtonLabel}
@@ -298,11 +305,11 @@ export class FeedbackWidget extends React.Component<FeedbackWidgetProps, Feedbac
298305
</View>
299306
)}
300307
<TouchableOpacity style={styles.submitButton} onPress={this.handleFeedbackSubmit}>
301-
<Text style={styles.submitText} testID='submit-button'>{text.submitButtonLabel}</Text>
308+
<Text style={styles.submitText} testID='submit-button' accessibilityLabel={text.submitButtonLabel}>{text.submitButtonLabel}</Text>
302309
</TouchableOpacity>
303310

304311
<TouchableOpacity style={styles.cancelButton} onPress={onCancel}>
305-
<Text style={styles.cancelText} testID='cancel-button'>{text.cancelButtonLabel}</Text>
312+
<Text style={styles.cancelText} testID='cancel-button' accessibilityLabel={text.cancelButtonLabel}>{text.cancelButtonLabel}</Text>
306313
</TouchableOpacity>
307314
</View>
308315
</TouchableWithoutFeedback>

0 commit comments

Comments
 (0)