-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update CONSTS to direct developers to use role instead of accessibilityRole #31590
Conversation
…BLITY_ROLE.TEXT` to point to `ROLE.PRESENTATION`
…g button` value by reverting them to `accessibilityRole`
…eprecatd CONST.ACCESSIBLITY_ROLE
…eprecatd CONST.ACCESSIBLITY_ROLE
…eprecatd CONST.ACCESSIBLITY_ROLE
…deprecatd CONST.ACCESSIBLITY_ROLE
…BLITY_ROLE with CONST.ROLE
Signed-off-by: Trevor Coleman <[email protected]>
Update CONSTS to direct developers to use role instead of accessibilityRole (Expensify#31500)
Hey! I see that you made changes to our Form component. Make sure to update the docs in FORMS.md accordingly. Cheers! |
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
# Conflicts: # src/components/AvatarWithImagePicker.js # src/components/Banner.tsx # src/components/Checkbox.js # src/components/ParentNavigationSubtitle.tsx # src/components/ReportHeaderSkeletonView.tsx # src/pages/ReimbursementAccount/BankAccountManualStep.js # src/pages/settings/Profile/PersonalDetails/AddressPage.js
@allroundexperts Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
Hi @trevor-coleman! This has conflicts. Can you please fix? |
Fixed conflicts. |
Hey @allroundexperts! Will you have time for a re-review today or sometime next week? Thank you! |
# Conflicts: # src/components/DatePicker/index.android.js # src/components/DatePicker/index.ios.js # src/components/DatePicker/index.js # src/components/HTMLEngineProvider/HTMLRenderers/MentionUserRenderer.js # src/components/RoomNameInput/index.native.js
# Conflicts: # src/components/ReportActionItem/ReportActionItemImage.js # src/pages/settings/Security/CloseAccountPage.js
Resolved merge conflicts. @allroundexperts -- because this touches so many files it may be good for us to coordinate our timing so we can get it merged before more conflicts arise. |
Reviewer Checklist
Screenshots/Videos |
@@ -28,7 +28,7 @@ function AttachmentViewImage({source, file, isAuthTokenRequired, loadComplete, o | |||
onPress={onPress} | |||
disabled={loadComplete} | |||
style={[styles.flex1, styles.flexRow, styles.alignSelfStretch]} | |||
role={CONST.ACCESSIBILITY_ROLE.IMAGEBUTTON} | |||
accessibilityRole={CONST.ACCESSIBILITY_ROLE.IMAGEBUTTON} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't this throw a deprecation warning? If so, we should either not use it or remove the @deprecated
comment from the const
file where this is defined.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I covered this in the description:
Note: In the IMAGEBUTTON Case, I thought it was best to preserve the imagebutton role information even though it uses the deprecated ACCESSIBILITY_ROLE. This minimizes the number of changes, rather than try to decide on a case-by-case basis what an appropriate replacement would be. ACCESSIBILITY_ROLE.IMAGEBUTTON is marked as deprecated and so it will be flagged and can be cleaned up the next time someone touches that component. In the meantime, the accessibilityRole prop is still supported in react-native (and will be for a long time) so there shouldn't be any problems.
But if you have enough context for this component to suggest what the correct value should be then I can make the change here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm... I would rather clean it up quick then let it hang around. Would you be available for the cleanup as a follow up PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@trevor-coleman Requested one more minor change. Also, can you please make sure to upload screen recordings / shots of all platforms regardless if your code is not modifying anything related to those? This requirement was added intentionally so that we can be super confident about the stability of our application!
So just a recording of me opening up the app and pressing random buttons and navigating around a bit? |
Correct! |
Ok, I've got another PR open at the moment, so this will probably be a few days. |
Completed the checklist. Should be good to merge after conflicts are resolved! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. I am approving it so that merging is not delayed after conflicts are fixed (This is catching conflicts real fast).
ef072ce
to
4ad45b3
Compare
Merge conflicts resolved |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Agreed that it would be ideal to fix that IMAGEBUTTON workaround in a follow up PR. Thanks!
oh, and one more thing, I think we added a couple new consts to |
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by https://github.com/dangrous in version: 1.4.12-0 🚀
|
🚀 Deployed to staging by https://github.com/dangrous in version: 1.4.12-0 🚀
|
🚀 Deployed to staging by https://github.com/dangrous in version: 1.4.12-0 🚀
|
🚀 Deployed to production by https://github.com/Julesssss in version: 1.4.12-2 🚀
|
Details
This fixes the issue with ROLE and ACCESSIBLITY_ROLE identified earlier and discussed on Slack.
It makes the following changes:
Changes to
CONST.ts
CONST.ACCESSIBILITY_ROLE.TEXT
to the value'text'
CONST.ACCESSIBLITY_ROLE
and all propertiesCONST.ROLE
object with JSDoc commentsFixes to Components
Simple find-replace
The majority of components were fixed using a simple find and replaced that made the following change
Replace:
role={CONST.ACCESSIBILITY_ROLE
withrole={CONST.ROLE
For example:
role={CONST.ACCESSIBILITY_ROLE.BUTTON}
would becomerole={CONST.ROLE.BUTTON}
Non-standard Cases
TEXT
to meanPRESENTATION
role={CONST.ACCESSIBILITY_ROLE.TEXT}
role={CONST.ROLE.PRESENTATION}
IMAGEBUTTON
IMAGEBUTTON
only available inaccessibilityRole
. Corrected property toaccessibilityRole
and pointed to the right const (see note below)role={CONST.ACCESSIBILITY_ROLE.IMAGEBUTTON}
accessibilityRole={CONST.ACCESSIBILITY_ROLE.IMAGEBUTTON}
ADJUSTABLE
adjustable
is not available inrole
but is inaccessibilityRole
. Reverted the value and updated prop to reflect correct usagerole={CONST.ACCESSIBILITY_ROLE.ADJUSTABLE}
role={CONST.ROLE.SLIDER}
ACCESSIBILITY_ROLE.IMAGE
role
valuerole={CONST.ACCESSIBILITY_ROLE.IMAGE}
role={CONST.ROLE.IMG}
Note: In the
IMAGEBUTTON
Case, I thought it was best to preserve theimagebutton
role information even though it uses the deprecatedACCESSIBILITY_ROLE
. This minimizes the number of changes, rather than try to decide on a case-by-case basis what an appropriate replacement would be.ACCESSIBILITY_ROLE.IMAGEBUTTON
is marked as deprecated and so it will be flagged and can be cleaned up the next time someone touches that component. In the meantime, theaccessibilityRole
prop is still supported in react-native (and will be for a long time) so there shouldn't be any problems.Fixed Issues
$ #31500
Tests
This was a find-replace operation that touched a lot of components, but should not cause any changes to the app's behaviour. I tried a number of ordinary operations and there was no discernable difference or error in the log.
Offline tests
This change will have no effect in offline mode as it only concerns front-end behaviour.
QA Steps
This change should not cause any changes to the app's behaviour. To test, open the app and generally test it through ordinary operations. There should be no discernable difference in the app's behaviour. or error in the log.
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
There should be no changes to the app's appearance or behaviour as a result of this change.