Make error message text selectable on desktop web in DotIndicatorMessage#86271
Make error message text selectable on desktop web in DotIndicatorMessage#86271
Conversation
Error messages rendered via DotIndicatorMessage inherit user-select: none from the parent PressableWithSecondaryInteraction. Add conditional userSelectText styling following the same pattern used by TextCommentFragment, so error messages are selectable on desktop web while keeping touch behavior unchanged. Co-authored-by: Sahil <thesahindia@users.noreply.github.com>
|
I created this PR from an upstream branch since I don't have push access to your fork. To take ownership of this branch and be able to push updates, run: Then you can close this PR and open a new one from your fork. |
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
|
@MelvinBot, replace the test and QA steps with the steps below:
|
|
Updated the Tests and QA Steps sections with the new steps as requested. |
|
@MelvinBot there was a typo, could you update it again with the steps below:
|
| // eslint-disable-next-line react/no-array-index-key | ||
| key={index} | ||
| style={[StyleUtils.getDotIndicatorTextStyles(isErrorMessage), textStyles]} | ||
| style={[StyleUtils.getDotIndicatorTextStyles(isErrorMessage), textStyles, !canUseTouchScreen() || !shouldUseNarrowLayout ? styles.userSelectText : styles.userSelectNone]} |
There was a problem hiding this comment.
@MelvinBot, can you extract this condition into a variable to improve readability?
There was a problem hiding this comment.
Extracted the condition into an isTextSelectable variable. Pushed in 9d3878f.
|
Updated the Tests and QA Steps sections with the corrected step 5: "Verify that the error text can be selected and copied on desktop web". |
Co-authored-by: Sahil <thesahindia@users.noreply.github.com>
|
@MelvinBot, please mark it as "Ready for review" |
|
Done! PR has been marked as Ready for review. |
|
@thesahindia 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] |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / SafariScreen.Recording.2026-03-26.at.8.12.10.AM.mov |
|
We did not find an internal engineer to review this PR, trying to assign a random engineer to #84639 as well as to this PR... Please reach out for help on Slack if no one gets assigned! |
|
@flodnv, @joekaufmanexpensify the original issue which was reported here, was about the sytem error message in the chat that can't be copied but QA logged the issue for different errors messages. I think not being able to select the error text in other places is expected. Text inside a Pressable component isn’t selectable across the app, and we see the same behavior for error text when it’s inside it (screen recording below). The original issue will be fixed by the current changes. Let me know if you see it differently. Screen.Recording.2026-03-26.at.9.08.48.AM.mov |
|
@thesahindia Just to make sure I'm following you're saying the fix in this PR will make it so message text is always copyiable (even if there's a pattern B error, which was the original issue), but copying won't extend to pressable components, like report rows? If so, is there a specific pattern for when it is vs isn't copyable on pressable components? It seems to be on some, like the left-hand-bar nav items. |
|
@joekaufmanexpensify and @joekaufmanexpensify @thesahindia is out for two weeks. Can you wrap this up without them? If not, can you post in #contributor-plus to find a C+ to? (I recommend stating the price at $75 or $125). Or... tag me in a comment on the issue and I can do it) |
joekaufmanexpensify
left a comment
There was a problem hiding this comment.
Good for product
|
🚧 @flodnv has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
✋ 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/flodnv in version: 9.3.54-0 🚀
Bundle Size Analysis (Sentry): |
|
No help site changes required. This PR is a CSS-only change that adds |
|
@thesahindia @joekaufmanexpensify This PR is failing because of a regression issue #87337 The issue is reproducible in: Mac - Safari Bug7124369_1775620455094.Recording__1972.mp4 |
Explanation of Change
Error messages in chat (rendered via
ErrorMessageRow→MessagesRow→DotIndicatorMessage) cannot be selected or copied on desktop web. This is because the parentPressableWithSecondaryInteractionappliesuser-select: noneviaaccessibilityRole='button', andDotIndicatorMessage's<Text>elements don't override this.This PR adds conditional
userSelectTextstyling to the<Text>element inDotIndicatorMessage, following the same pattern already used byTextCommentFragment. On desktop web (non-touch screens or non-narrow layouts),styles.userSelectTextis applied so error message text is selectable. On touch devices,styles.userSelectNoneis applied to prevent accidental selection during scrolling.Fixed Issues
$ #84639
PROPOSAL: #84639 (comment)
Tests
Offline tests
This change is purely cosmetic (CSS
user-selectstyling). No offline behavior is affected.QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
N/A - This change only affects desktop web text selection behavior (CSS
user-selectproperty). No visible change on native Android.Android: mWeb Chrome
N/A - Touch device;
userSelectNoneis applied on touch screens to prevent accidental selection.iOS: Native
N/A - This change only affects desktop web text selection behavior. No visible change on native iOS.
iOS: mWeb Safari
N/A - Touch device;
userSelectNoneis applied on touch screens to prevent accidental selection.MacOS: Chrome / Safari
Tested on desktop web — error message text ("Please enter a valid merchant") is now selectable with click and drag. Blue selection highlight appears correctly.