Skip to content

Commit d41715f

Browse files
committed
Fix accessibility live region lint feedback
1 parent cf45ada commit d41715f

11 files changed

Lines changed: 16 additions & 9 deletions

File tree

eslint-plugin-local-rules/require-a11y-disable-justification.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ const name = 'require-a11y-disable-justification';
22

33
const ISSUE_URL_REGEX = /https?:\/\/github\.com\/(?:Expensify\/App|FormidableLabs\/eslint-plugin-react-native-a11y)\/(?:issues|pull)\/\d+/i;
44
const ISSUE_URL_GLOBAL_REGEX = /https?:\/\/github\.com\/(?:Expensify\/App|FormidableLabs\/eslint-plugin-react-native-a11y)\/(?:issues|pull)\/\d+/gi;
5-
const DISABLE_A11Y_REGEX = /eslint-disable(?:-next-line|-line)?\s+[^]*?react-native-a11y\//i;
5+
const DISABLE_A11Y_REGEX = /eslint-disable(?:-next-line|-line)?\s+[\s\S]*?react-native-a11y\//i;
6+
const MIN_RATIONALE_LENGTH = 12;
67

78
const meta = {
89
type: 'problem',
@@ -35,7 +36,7 @@ function hasRationale(commentText) {
3536
.replaceAll(/\s+/g, ' ')
3637
.trim();
3738

38-
return strippedComment.length >= 12;
39+
return strippedComment.length >= MIN_RATIONALE_LENGTH;
3940
}
4041

4142
function create(context) {

eslint-plugin-local-rules/require-live-region-for-status-updates.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ function create(context) {
156156
return;
157157
}
158158

159-
if (hasKnownStatusRole && liveRegionValue === 'none') {
159+
if ((hasKnownStatusRole || hasAnyResolvedStatusRole) && liveRegionValue === 'none') {
160160
context.report({
161161
node,
162162
messageId: 'invalidLiveRegion',

src/CONST/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6144,6 +6144,8 @@ const CONST = {
61446144
ROLE: {
61456145
/** Use for elements with important, time-sensitive information. */
61466146
ALERT: 'alert',
6147+
/** Use for elements with advisory information that should be announced without interrupting the user. */
6148+
STATUS: 'status',
61476149
/** Use for elements that act as buttons. */
61486150
BUTTON: 'button',
61496151
/** Use for elements representing checkboxes. */

src/components/Attachments/AttachmentCarousel/CarouselItem.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ function CarouselItem({item, onPress, isFocused, isModalHovered, reportID}: Caro
7272
accessibilityRole={CONST.ROLE.BUTTON}
7373
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
7474
accessibilityLabel={item.file?.name || translate('attachmentView.unknownFilename')}
75-
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
7675
sentryLabel={CONST.SENTRY_LABEL.ATTACHMENT_CAROUSEL.ITEM}
7776
>
7877
{children}

src/components/Attachments/AttachmentView/AttachmentViewImage/index.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ function AttachmentViewImage({attachmentID, url, file, isAuthTokenRequired, load
3838
accessibilityRole={CONST.ROLE.BUTTON}
3939
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
4040
accessibilityLabel={file?.name || translate('attachmentView.unknownFilename')}
41-
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
4241
sentryLabel={CONST.SENTRY_LABEL.ATTACHMENT_CAROUSEL.ITEM}
4342
>
4443
{children}

src/components/PDFView/index.native.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,6 @@ function PDFView({onToggleKeyboard, onLoadComplete, fileName, onPress, isFocused
222222
accessibilityRole={CONST.ROLE.BUTTON}
223223
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
224224
accessibilityLabel={fileName || translate('attachmentView.unknownFilename')}
225-
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
226225
sentryLabel={CONST.SENTRY_LABEL.PDF_VIEW.DOCUMENT}
227226
>
228227
{renderPDFView()}

src/components/PDFView/index.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ function PDFView({onToggleKeyboard, fileName, onPress, isFocused, sourceURL, sty
138138
accessibilityRole={CONST.ROLE.BUTTON}
139139
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
140140
accessibilityLabel={fileName || translate('attachmentView.unknownFilename')}
141-
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
142141
sentryLabel={CONST.SENTRY_LABEL.PDF_VIEW.DOCUMENT}
143142
>
144143
{renderPDFView()}

src/components/TransactionItemRow/ReceiptPreview/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ function ReceiptPreview({source, hovered, isEReceipt = false, transactionItem}:
119119
{shouldShowImage ? (
120120
<View style={[styles.w100]}>
121121
{isLoading && (
122-
<View style={[StyleSheet.absoluteFill, styles.justifyContentCenter, styles.alignItemsCenter]}>
122+
<View style={[StyleSheet.absoluteFillObject, styles.justifyContentCenter, styles.alignItemsCenter]}>
123123
<ActivityIndicator
124124
size={CONST.ACTIVITY_INDICATOR_SIZE.LARGE}
125125
reasonAttributes={reasonAttributes}

src/components/ValidateCodeActionModal/ValidateCodeForm/BaseValidateCodeForm.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ function BaseValidateCodeForm({
337337
)}
338338
</OfflineWithFeedback>
339339
<View
340-
role="status"
340+
role={CONST.ROLE.STATUS}
341341
accessibilityLiveRegion="polite"
342342
>
343343
{!!validateCodeSent && (

src/pages/inbox/report/actionContents/FraudAlertContent.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ function FraudAlertContent({action, reportID}: FraudAlertContentProps) {
4545
return (
4646
<View
4747
accessibilityRole={CONST.ROLE.ALERT}
48+
accessibilityLiveRegion="assertive"
4849
accessibilityLabel={translate('reportFraudConfirmationPage.title')}
4950
>
5051
<ReportActionItemBasicMessage message={message} />

0 commit comments

Comments
 (0)