Skip to content
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

Fix URL rendering #6392

Merged
merged 8 commits into from
Nov 25, 2021
Merged

Fix URL rendering #6392

merged 8 commits into from
Nov 25, 2021

Conversation

parasharrajat
Copy link
Member

@parasharrajat parasharrajat commented Nov 22, 2021

Details

  1. Used Text node instead of Pressable to create inline layout inside the text to block overflow.
  2. Due to on web Text does support LongPress, used display:inline to create inline block.

Fixed Issues

$ #5572
$ #4911

Tests | QA Steps

  1. Send a new message with a link.
    e.g. hello https://expensify.slack.com/archives/C01GTK53T8Q/p1632613507072000?
  2. Check the message on native devices, does not overflow.
  3. Resize the browser on the Web, it should wrap correctly.

Tested On

  • Web
  • Mobile Web
  • Desktop
  • iOS
  • Android

Screenshots

Web | Desktop

output_file.mp4

Mobile Web

output_file.mp4

iOS

Android

output_file.mp4

@parasharrajat parasharrajat requested a review from a team as a code owner November 22, 2021 17:54
@MelvinBot MelvinBot requested review from mountiny and removed request for a team November 22, 2021 17:54
Copy link
Contributor

@mountiny mountiny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Skimmed over this quickly. Looks good I just found one typo. I will test it out a bit more later.

@@ -21,13 +21,22 @@ const propTypes = {

/** Prevent the default ContextMenu on web/Desktop */
preventDefaultContentMenu: PropTypes.bool,

/** Use Text instead of Presable to create inline layout.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NAB: Typo

Suggested change
/** Use Text instead of Presable to create inline layout.
/** Use Text instead of Pressable to create inline layout.

@parasharrajat
Copy link
Member Author

parasharrajat commented Nov 22, 2021

A few points for the reviewer:

  1. I have to use styling instead of the same Text node for the web. As RN-web decided to not implement the LongPress on Text as RN.
  2. Left unsupported onPressIn and onPressOut events as they do not have any effect but are needed for non-inline mode.
  3. Added a detailed comment for an inline prop but it is half correct. Web does support those mentioned props as it is still using Pressable.

There is one known issue to me apart from the ones which I am fixing.

  • on the Web, the Mini menu does not hide when URL ContextMenu is opened. It would require a hacky solution to be fixed.

my other approach to fix this issue also fixes it but that is very complex. I still think not a priority issue so we should adopt the simpler approach over the complex one for now which PR is doing.

@parasharrajat
Copy link
Member Author

I will add videos later before lets go over review.

@parasharrajat
Copy link
Member Author

@mountiny Thoughts...?

@mountiny
Copy link
Contributor

@parasharrajat Sorry, I got a bit stuck with university coursework. Looking into it now.

Tested it and seems to work well, which is great. The concern from the OG comment was the inability to set the custom delay for long press which is no really a problem since we use default and it is probably good to use default as that is what users are most likely used to.

on the Web, the Mini menu does not hide when URL ContextMenu is opened. It would require a hacky solution to be fixed.

Could you share screenshare of how this problem looks like? It does not look like a deal breaker for sure.

I like this approach so feel free to update the PR body appropriately with all QA steps for both issues and videos, I will give the code another look.

Copy link
Contributor

@mountiny mountiny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I feel like if the limitations do not break any current functionality and fix the listed problems, it is a good way to go. Let me know when this is ready for final look.

@parasharrajat
Copy link
Member Author

Could you share screenshare of how this problem looks like? It does not look like a deal breaker for sure.

Correct not a deal-breaker. I was referring to this Mini-action menu on right. It hides when ContextMenu is open but not when the URL ContextMenu is..
Screenshot 2021-11-25 01:46:30

I will update the videos and details

@mountiny
Copy link
Contributor

@parasharrajat That is no problem:)

@parasharrajat
Copy link
Member Author

@mountiny Changes done. Ready for final review.

@mountiny mountiny self-requested a review November 24, 2021 21:45
Copy link
Contributor

@mountiny mountiny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just requesting comment to be added to two places. Thank you for the changes.

</Pressable>
);
const PressableWithSecondaryInteraction = (props) => {
const Node = props.inline ? RNText : Pressable;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@parasharrajat I think it might be worth adding a little comment explaining this option here as well. I know you have added the comment to the PropType, but one compact line in here would be handy. Can you please add one? Thank you 🙌

</Pressable>
);
const PressableWithSecondaryInteraction = (props) => {
const Node = props.inline ? RNText : Pressable;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

@parasharrajat
Copy link
Member Author

Done

@mountiny
Copy link
Contributor

Yikes, there is some linter problem 😬

@parasharrajat
Copy link
Member Author

Linting issues fixed @mountiny.

@mountiny mountiny merged commit 5249e8c into Expensify:main Nov 25, 2021
@OSBotify
Copy link
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by @mountiny in version: 1.1.16-11 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

@ogumen
Copy link

ogumen commented Dec 1, 2021

Accessibility issues found in this PR:

  1. The link sent as part of the message cannot be activated using keyboard - failure of WCAG SC 2.1.1 (The issue can be fixed by removing the <div tabindex="0"> wrapping around the hyperlink).
Chat_link.sent.cannot.be.activated.using.keyboard.mp4
  1. The blue link text against white background fails minimum color contrast requirements of 4.50:1 for small text. The font is 11pt, wont weight 400. The blue (#0184FF) on white background (#FFFFFF) has a color contrast ratio of 3.65:1 - failure of WCAG SC 1.4.3
    Chat_Blue link text on white background fails contrast requirements

@OSBotify
Copy link
Contributor

OSBotify commented Dec 6, 2021

🚀 Deployed to production by @roryabraham in version: 1.1.17-7 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants