-
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
Ignore unselectable text from selection #27421
Conversation
Hey! I see that you made changes to our Form component. Make sure to update the docs in FORMS.md accordingly. Cheers! |
@0xmiroslav 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] |
The issue only happens when using the copy shortcut, so the fix is only applied to a component with a user-select none style on the web (large screen). However, we still have 1 component that I haven't applied the fix yet, that is OfflineWithFeedback. The reason is, that OfflineWithFeedback is used in some places where the children override the user-select none to user-select text, for example, BaseAnchorForCommentsOnly. This means, that even though the OfflineWithFeedback is not selectable, the BaseAnchorForCommentsOnly is still selectable. If we ignore the selection from all OfflineWithFeedback, selecting anchor text and copying it will not include the anchor text, as shown below: Screen.Recording.2023-09-14.at.17.18.00.movI don't know the reason why we are setting the user-select text to BaseAnchorForCommentsOnly or to all markdown text actually (in BaseHTMLEngineProvider), but the question is, do we ignore it or add new props to OfflineWithFeedback (called
|
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.
Seems like you put dataSet code on all views where selectable={false}
is passed.
Can we put in base component - Text, BaseGenericPressable so if selectable={false}
is passed, add dataSet
prop manually?
@0xmiroslav that's actually a nice idea, but I see that react-native-web 0.19 deprecated |
Makes sense 👍 |
@bernhardoj please fix conflict |
Conflicts solved |
@@ -28,6 +29,7 @@ function EditedRenderer(props) { | |||
<Text | |||
selectable={false} | |||
style={[styles.w1, styles.userSelectNone]} | |||
dataSet={{[CONST.SELECTION_SCRAPER_HIDDEN_ELEMENT]: 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.
Personally I think adding space (messsage (edited)
) is better than no space (messsage(edited)
)
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.
yeah, me too, but I don't know why we added userSelectNone
to the space.
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.
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.
huh interesting, let's keep it then
Reviewer Checklist
Screenshots/VideosWebweb1.movweb2.movMobile Web - ChromeMobile Web - SafariDesktopiOSAndroid |
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!
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, thanks for the thorough testing here!
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
Thank you for taking this into consideration @bernhardoj @0xmiroslav |
🚀 Deployed to staging by https://github.com/Li357 in version: 1.3.71-0 🚀
|
🚀 Deployed to production by https://github.com/thienlnam in version: 1.3.71-12 🚀
|
Details
On the web, there is some text that is not selectable but we can still copy it when using copy shortcut CTRL+C.
Fixed Issues
$ #26694
PROPOSAL: #26694 (comment)
Tests
Same as QA Steps
Offline tests
Same as QA Steps
QA Steps
Web
NOTE: if you encounter a case where the pasted text contains some random style text, it's a known issue that won't be fixed based on this comment
Emoji reaction:
Menu item:
Multiple Avatars 1:
Multiple Avatars 2:
Calendar:
Edited message:
Reply:
List item 1:
List item 2:
New message:
Text input prefix
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
Emoji reaction
emoji.mov
List 1 (RadioListItem)
radio.list.item.mov
List 2 (BaseSelectionList + UserListItem)
selection.list.mov
MenuItem (timezone)
timezone.menuitem.mov
MultipleAvatars
multiple.avatar_2.mov
multiple_avatar_1.mov
CalendarPicker + Button
button.+.calendar.mov
Edited text
edited.mov
Thread reply
reply.mov
Floating New message
new.message.mov
Prefix
prefix.mov
Mobile Web - Chrome
Mobile Web - Safari
Desktop
iOS
Android