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

[$250] VBA -URL is shown on bottom left corner when Fix the error is hovered reported by @huzaifa-99 #12692

Closed
kavimuru opened this issue Nov 12, 2022 · 66 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Overdue

Comments

@kavimuru
Copy link

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Action Performed:

  1. Navigate to /bank-account/BankAccountStep
  2. Click on the first field, and then click outside, just to blur the field and force the validation error to be shown
  3. Notice that an error label appears before submit button with blue coloured “fix the errors” text inside the label
  4. Hover on “fix the errors” text
  5. Notice it shows url address on bottom/left corner of the browser with the current url address set

Expected Result:

The label “fix-the-errors” should not show url-address when hovered

Actual Result:

“fix-the-errors” label is showing the current url as address on bottom-left screen corner when hovered

Workaround:

unknown

Platform:

Where is this issue occurring?

  • Web

Version Number: 1.2.27-3
Reproducible in staging?: y
Reproducible in production?: y
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos:

https://user-images.githubusercontent.com/43996225/201452993-388bb712-3673-4a28-822c-43aeb6623b99.mp4
Untitled

Expensify/Expensify Issue URL:
Issue reported by: @huzaifa-99
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1668124426446149

View all open jobs on GitHub

@kavimuru kavimuru added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Nov 12, 2022
@melvin-bot
Copy link

melvin-bot bot commented Nov 12, 2022

Triggered auto assignment to @zanyrenney (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@hungvu193
Copy link
Contributor

hungvu193 commented Nov 12, 2022

Proposal
In our current TextLink.js component, we are using the href props, that's why we see the bottom left url when the cursor hovered it.

<Text
style={[styles.link, ...additionalStyles]}
accessibilityRole="link"
href={props.href}
onPress={openLink}
onKeyDown={openLinkIfEnterKeyPressed}
>

Solution
To make it didn't show the bottom left url when hovered we can pass undefined as href prop. In some case, we need to use the TextLink.js but we didn't pass the href (like in this issue), we need to define the href prop default value.

        <Text
            style={[styles.link, ...additionalStyles]}
            accessibilityRole="link"
-           href={props.href} 
+           href={props.href ? props.href : undefined}
            onPress={openLink}
            onKeyDown={openLinkIfEnterKeyPressed}
        >
            {props.children}
        </Text>

or we can change the TextLink.js defaultProps:

const defaultProps = {
-   href:  '',
+   href: undefined,
    style: [],
    onPress: undefined,
};

Result:

Screen.Recording.2022-11-13.at.00.29.12.mov

@huzaifa-99
Copy link
Contributor

huzaifa-99 commented Nov 13, 2022

Proposal

The issue has origins in FormAlertWrapper. We are using a TextLink there which display's the current url when hovered

<TextLink
style={styles.label}
onPress={props.onFixTheErrorsLinkPressed}
>
{props.translate('common.fixTheErrors')}
</TextLink>

Since we are not passing an actual link/href prop, this TextLink can be replaced with a normal Text component and adding link styles

<Text
    style={[styles.label, styles.link]}
    onPress={props.onFixTheErrorsLinkPressed}
>
    {props.translate('common.fixTheErrors')}
</Text>

which fixes the bug

Demo

12692.-.Demo.-.Hide.url.when.hovered.over.link.-.Screen.Recording.2022-11-14.at.1.32.53.AM.mp4

@0xmiros
Copy link
Contributor

0xmiros commented Nov 13, 2022

Your proposal will cause accessibility issue.
Cannot focus and click on fix the errors using TAB and Enter keyboard

@huzaifa-99
Copy link
Contributor

I thought we are not handling accessibility as discussed here

@0xmiros
Copy link
Contributor

0xmiros commented Nov 13, 2022

I thought we are not handling accessibility as discussed here

But that doesn't mean it's fine to break currently working accessibility feature

@huzaifa-99
Copy link
Contributor

Updated Proposal (original #12692 (comment))

If not breaking accessibility is a concern than we can wrap the Text in a Pressable and add the press callback there. And since it will be nested inside a Text it might break wrapping on native, so we can wrap it in a View.

Basically replacing this whole block

<Text style={[styles.formError, styles.mb0]}>
{`${props.translate('common.please')} `}
<TextLink
style={styles.label}
onPress={props.onFixTheErrorsLinkPressed}
>
{props.translate('common.fixTheErrors')}
</TextLink>
{` ${props.translate('common.inTheFormBeforeContinuing')}.`}
</Text>
with

<View style={{ flexDirection: 'row' }}>
    <Text style={[styles.formError, styles.mb0]}>
        {`${props.translate('common.please')} `}
    </Text>
    <Pressable onPress={props.onFixTheErrorsLinkPressed}>
        <Text style={[styles.label, styles.link]}>
            {props.translate('common.fixTheErrors')}
        </Text>
    </Pressable>
    <Text style={[styles.formError, styles.mb0]}>
        {` ${props.translate('common.inTheFormBeforeContinuing')}.`}
    </Text>
</View>

This also achieves the same result but accessibility is not broken

@melvin-bot melvin-bot bot added the Overdue label Nov 14, 2022
@hungvu193
Copy link
Contributor

hungvu193 commented Nov 14, 2022

This will cause an error console on web, you need to make sure there's no console error happened with your solution.

    <Pressable onPress={props.onFixTheErrorsLinkPressed}>
        <Text style={[styles.label, styles.link]}>
            {props.translate('common.fixTheErrors')}
        </Text>
    </Pressable>

@mdneyazahmad
Copy link
Contributor

@huzaifa-99 are you able to reproduce the issue in dev? I can reproduce the issue in staging, but not in dev.

@huzaifa-99
Copy link
Contributor

huzaifa-99 commented Nov 14, 2022

@hungvu193 i see no console errors specific to this change. Can you please describe a little more? Thanks


@mdneyazahmad yes still reproducible on v1.2.27-3 (DEV)

@hungvu193
Copy link
Contributor

Screen.Recording.2022-11-14.at.20.00.58.mov

@huzaifa-99 FYI

@huzaifa-99
Copy link
Contributor

huzaifa-99 commented Nov 14, 2022

Hm strange, I don't get this error. @hungvu193 Can you please expand the log to see the stack trace. Thanks in advance

For a reference please see this demo (ignore the 30x git file changes in my vscode, they are just console logs)

No.console.errors.on.fix.Screen.Recording.2022-11-14.at.6.52.31.PM.mp4

@hungvu193
Copy link
Contributor

@huzaifa-99 Sure, here you are
Screen Shot 2022-11-14 at 21 40 52

@huzaifa-99
Copy link
Contributor

@hungvu193 I see where the problem is.

In your video demo, you are using this code

<Pressable 
    style={[styles.label, styles.link]}
    onPress={props.onFixTheErrorsLinkPressed}
>    
    {props.translate('common.fixTheErrors')}
</Pressable>

but in your comment here, it was different. That's why you get the error because {props.translate('common.fixTheErrors')} should be wrapped in a Text element

Again see my proposal here for the correct code block

@hungvu193
Copy link
Contributor

@hungvu193 I see where the problem is.

In your video demo, you are using this code

<Pressable 
    style={[styles.label, styles.link]}
    onPress={props.onFixTheErrorsLinkPressed}
>    
    {props.translate('common.fixTheErrors')}
</Pressable>

but in your comment here, it was different. That's why you get the error because {props.translate('common.fixTheErrors')} should be wrapped in a Text element

Again see my proposal here for the correct code block

ah I see.

@mdneyazahmad
Copy link
Contributor

mdneyazahmad commented Nov 14, 2022

Proposal

If href property is not null, a is rendered. So pass null for non href link. Also add focusable prop to focus on tab navigation when it is not a href link.

diff --git a/src/components/TextLink.js b/src/components/TextLink.js
index 55344d987..3aa2aaf25 100644
--- a/src/components/TextLink.js
+++ b/src/components/TextLink.js
@@ -58,9 +58,10 @@ const TextLink = (props) => {
 
     return (
         <Text
+            focusable
             style={[styles.link, ...additionalStyles]}
             accessibilityRole="link"
-            href={props.href}
+            href={props.href ? props.href : null}
             onPress={openLink}
             onKeyDown={openLinkIfEnterKeyPressed}
         >

OR

diff --git a/src/components/TextLink.js b/src/components/TextLink.js
index 55344d987..bff36764b 100644
--- a/src/components/TextLink.js
+++ b/src/components/TextLink.js
@@ -25,7 +25,7 @@ const propTypes = {
 };
 
 const defaultProps = {
-    href: '',
+    href: null,
     style: [],
     onPress: undefined,
 };
@@ -58,6 +58,7 @@ const TextLink = (props) => {
 
     return (
         <Text
+            focusable
             style={[styles.link, ...additionalStyles]}
             accessibilityRole="link"
             href={props.href}

Can somebody test this for me. I am not able to reproduce on my macbook.

@melvin-bot
Copy link

melvin-bot bot commented Nov 14, 2022

Looks like something related to react-navigation may have been mentioned in this issue discussion.

As a reminder, please make sure that all proposals are not workarounds and that any and all attempt to fix the issue holistically have been made before proceeding with a solution. Proposals to change our DeprecatedCustomActions.js files should not be accepted.

Feel free to drop a note in #expensify-open-source with any questions.

@mdneyazahmad
Copy link
Contributor

Updated Proposal

This fixes the issue

diff --git a/src/components/TextLink.js b/src/components/TextLink.js
index 55344d987..a453b9788 100644
--- a/src/components/TextLink.js
+++ b/src/components/TextLink.js
@@ -25,7 +25,7 @@ const propTypes = {
 };
 
 const defaultProps = {
-    href: '',
+    href: null,
     style: [],
     onPress: undefined,
 };

Thanks @huzaifa-99 I can reproduce the issue in DEV.

@zanyrenney
Copy link
Contributor

The job listing is here: https://www.upwork.com/jobs/~01bd917604edb70bce

@melvin-bot melvin-bot bot removed the Overdue label Nov 14, 2022
@zanyrenney zanyrenney added the External Added to denote the issue can be worked on by a contributor label Nov 15, 2022
@melvin-bot
Copy link

melvin-bot bot commented Nov 15, 2022

Current assignee @zanyrenney is eligible for the External assigner, not assigning anyone new.

@melvin-bot
Copy link

melvin-bot bot commented Nov 15, 2022

Triggered auto assignment to Contributor-plus team member for initial proposal review - @parasharrajat (External)

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Nov 15, 2022
@zanyrenney
Copy link
Contributor

I am having troubles logging in to Upwork just now:
2022-11-24_12-15-07

I'll hire you when I get it sorted, sorry @hungvu193

@melvin-bot melvin-bot bot removed the Overdue label Nov 24, 2022
@hungvu193
Copy link
Contributor

I am having troubles logging in to Upwork just now: 2022-11-24_12-15-07

I'll hire you when I get it sorted, sorry @hungvu193

no worries :)

@zanyrenney
Copy link
Contributor

I got back in and have hired you @hungvu193 - let me know if you have any further questions :)

@hungvu193
Copy link
Contributor

I got back in and have hired you @hungvu193 - let me know if you have any further questions :)

Thank you, I accepted your offer :)

@huzaifa-99
Copy link
Contributor

@zanyrenney am I eligible for reporting on this?

@zanyrenney
Copy link
Contributor

Yes! I have hired you there too @huzaifa-99 :)

@melvin-bot
Copy link

melvin-bot bot commented Nov 28, 2022

@hungvu193, @parasharrajat, @zanyrenney, @aldo-expensify Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@melvin-bot melvin-bot bot added the Overdue label Nov 28, 2022
@zanyrenney
Copy link
Contributor

Hired contributors, waiting on the reviews @aldo-expensify @parasharrajat

@melvin-bot melvin-bot bot removed the Overdue label Nov 28, 2022
@parasharrajat
Copy link
Member

PR deployed to PROD 5 days back. #12858 (comment)

@zanyrenney
Copy link
Contributor

Waiting until the 7 days and then we will be ready for payment.

@melvin-bot melvin-bot bot added the Overdue label Dec 2, 2022
@zanyrenney
Copy link
Contributor

sent the payment to you both on upwork @hungvu193 @huzaifa-99 - any questions, lmk!

@melvin-bot melvin-bot bot removed the Overdue label Dec 2, 2022
@hungvu193
Copy link
Contributor

@zanyrenney Since the PR was merged within 3 days, Can I have the bonus as well?

@parasharrajat
Copy link
Member

@zanyrenney Could you please send me offer for C+?

@melvin-bot melvin-bot bot added the Overdue label Dec 8, 2022
@aldo-expensify
Copy link
Contributor

Friendly bump @zanyrenney

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Dec 8, 2022
@zanyrenney
Copy link
Contributor

have also extended the contract to you @parasharrajat - please accept it so I can pay it out.

@hungvu193 bonus has been paid.

@melvin-bot melvin-bot bot removed the Overdue label Dec 12, 2022
@parasharrajat
Copy link
Member

@zanyrenney Accepted.

@melvin-bot melvin-bot bot added the Overdue label Dec 15, 2022
@zanyrenney
Copy link
Contributor

@parasharrajat paid, inc bonus! closing this issue out now as everyone has been paid.

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Dec 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Overdue
Projects
None yet
Development

No branches or pull requests

10 participants