-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
17047 migrate PressableWithSecondaryInteraction to PressableWithFeedback component #20251
17047 migrate PressableWithSecondaryInteraction to PressableWithFeedback component #20251
Conversation
c810db2
to
c558bcd
Compare
c558bcd
to
b901d25
Compare
@luacmartins @0xmiroslav One of you needs to 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] |
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.
@robertKozik please link correct issue. It's not 14047 but #17047
src/components/AnchorForCommentsOnly/BaseAnchorForCommentsOnly.js
Outdated
Show resolved
Hide resolved
Created the CONST values for accessibility roles 🚀 |
7803209
to
5cd97a3
Compare
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.
LGTM! Thanks for adding the const.
@0xmiroslav all yours |
@robertKozik we have conflicts. Could you please resolve those? |
BUG?: opacity change on hover Before: Screen.Recording.2023-06-09.at.6.01.46.PM.movAfter: Screen.Recording.2023-06-09.at.6.00.44.PM.mov |
@0xmiroslav @luacmartins I had difficulties with reproduction the problem on mSafari, but it turned out that it is more visible on the mChrome. When user tried to longPress over the text, selection of it has priority over our defined handler. I came up with the following solution: The problem from the prod is still visible tho, it only occurs on the mSafari. With above styles applied, it's less intrusive, but still visible. |
This will prevent text selection on all buttons throughout the app. I am not sure if this causes any unknown problem. |
PressableWithSecondaryInteraction is only used in three places, which are listed here. If my assumptions of the nature of the problem are correct (text selection), it can occur on every instance of it when it wraps text. |
@robertKozik we have conflicts. |
@0xmiroslav bumping, as I said in my comment before, the no selection policy is only referring to the PressableWithSecondaryInteraction (3 places in the app). On the other hand, if you prefer, that prohibition of text selection can only be added inside the LHN instance of the PressableWithSecondaryInteraction. |
@robertKozik we have conflicts. Could you please resolve? I'll do a final review once that's done. |
…ableWithSecondaryInteraction
@luacmartins merged with main |
@@ -76,10 +76,11 @@ class PressableWithSecondaryInteraction extends Component { | |||
|
|||
// On Web, Text does not support LongPress events thus manage inline mode with styling instead of using Text. | |||
return ( | |||
<Pressable | |||
<PressableWithFeedback | |||
wrapperStyle={StyleUtils.combineStyles(DeviceCapabilities.canUseTouchScreen() ? [styles.userSelectNone, styles.noSelect] : [])} |
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.
This should be consistent with others. They're using ControlSelection to prevent selection on long-click.
App/src/components/MenuItem.js
Lines 113 to 114 in e6c4b4e
onPressIn={() => props.shouldBlockSelection && props.isSmallScreenWidth && DeviceCapabilities.canUseTouchScreen() && ControlSelection.block()} | |
onPressOut={ControlSelection.unblock} |
App/src/components/AnchorForAttachmentsOnly/index.js
Lines 12 to 13 in e6c4b4e
onPressIn={() => DeviceCapabilities.canUseTouchScreen() && ControlSelection.block()} | |
onPressOut={() => ControlSelection.unblock()} |
App/src/pages/home/report/ReportActionItem.js
Lines 450 to 451 in e6c4b4e
onPressIn={() => props.isSmallScreenWidth && DeviceCapabilities.canUseTouchScreen() && ControlSelection.block()} | |
onPressOut={() => ControlSelection.unblock()} |
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 think we can generalize this. How about introducing shouldBlockSelection
prop in PressableWithSecondaryInteraction
component? And all above code can be removed and simply set shouldBlockSelection
to true.
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.
Anyway, this is not a blocker for this PR.
As a follow-up, I suggest to
|
Reviewer Checklist
Screenshots/VideosWebweb.movmsafari2.movMobile Web - Chromemchrome.movMobile Web - Safarimsafari.movDesktopdesktop.moviOSios.movAndroidandroid.mov |
The issue for the const values is already created (LINK) |
✋ 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/luacmartins in version: 1.3.31-0 🚀
|
🚀 Deployed to production by https://github.com/luacmartins in version: 1.3.31-3 🚀
|
🚀 Deployed to production by https://github.com/luacmartins in version: 1.3.31-3 🚀
|
@@ -76,10 +76,11 @@ class PressableWithSecondaryInteraction extends Component { | |||
|
|||
// On Web, Text does not support LongPress events thus manage inline mode with styling instead of using Text. | |||
return ( | |||
<Pressable | |||
<PressableWithFeedback | |||
wrapperStyle={StyleUtils.combineStyles(DeviceCapabilities.canUseTouchScreen() ? [styles.userSelectNone, styles.noSelect] : [])} |
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.
If inline
is true, this should be passed to wrapperStyle
as well, not only to style
.
More details about the root cause: #22362 (comment)
@@ -122,6 +122,8 @@ function MenuItem(props) { | |||
]} | |||
disabled={props.disabled} | |||
ref={props.forwardedRef} | |||
accessibilityRole={CONST.ACCESSIBILITY_ROLE.MENUITEM} | |||
accessibilityLabel={props.title} |
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.
props.title
was of number 0
in some cases which caused app crash as mentioned here #25451 (comment).
We should make sure the values we pass are string.
Details
Fixed Issues
$ #17047
PROPOSAL: #17047
Tests
PressableWithSecondaryInteraction is used in three places: reports in LHN, options in RHN, and emoji bubbles and links/mails in Chats
Offline tests
QA Steps
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)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)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
Web
Desktop.-.web.mov
Mobile Web - Chrome
android.-.web.mov
Mobile Web - Safari
iOS.-.web.mov
Desktop
Desktop.-.native.mov
iOS
iOS.-.native.mov
Android
android.-.native.mov