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

[HOLD for payment 2023-12-15] [$500] mWeb/Chrome - Login - Input field on Login page gets white background after using auto-fill #31415

Closed
1 of 6 tasks
lanitochka17 opened this issue Nov 16, 2023 · 42 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor

Comments

@lanitochka17
Copy link

lanitochka17 commented Nov 16, 2023

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Version Number: 1.4.0-0
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: Applause - Internal Team
Slack conversation:

Action Performed:

  1. Open staging.new.expenisfy.com
  2. On login page, enter email credentials using auto-fill function

Expected Result:

Email is entered with no problem

Actual Result:

Email is entered but login field now has a white background

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Chrome
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Bug6278465_1700100200447.RPReplay_Final1700088873.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0103638f798337746d
  • Upwork Job ID: 1724982458860752896
  • Last Price Increase: 2023-11-30
  • Automatic offers:
    • tienifr | Contributor | 27903407
Issue OwnerCurrent Issue Owner: @jliexpensify
@lanitochka17 lanitochka17 added External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Nov 16, 2023
@melvin-bot melvin-bot bot changed the title mWeb/Chrome - Login - Input field on Login page gets white background after using auto-fill [$500] mWeb/Chrome - Login - Input field on Login page gets white background after using auto-fill Nov 16, 2023
Copy link

melvin-bot bot commented Nov 16, 2023

Job added to Upwork: https://www.upwork.com/jobs/~0103638f798337746d

Copy link

melvin-bot bot commented Nov 16, 2023

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

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

melvin-bot bot commented Nov 16, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

Copy link

melvin-bot bot commented Nov 16, 2023

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

@wlegolas
Copy link
Contributor

wlegolas commented Nov 16, 2023

Proposal

Please re-state the problem that we are trying to solve in this issue.

mWeb/Chrome - Login - Input field on Login page gets white background after using auto-fill

What is the root cause of that problem?

The mobile Chrome on iOS appears to use iOS's WKWebView, and WKWebView doesn't support non-standard webkit features. The support for WebKit feature is supported by the Blink engine, which is Chrome's rendering engine, that the reason we are seeing this behavior on iOS mWeb Chrome.

Although the WKWebView supports some non-standard like the autofill, the Browser doesn't apply the CSS autofill pseudo-class to mark the field as auto-filled, that is the reason the styles below are not applied to the field.

App/web/index.html

Lines 76 to 89 in 91ef640

/* Customizes the background and text colors for autofill inputs in Chrome */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
textarea:-webkit-autofill:hover,
textarea:-webkit-autofill:focus,
select:-webkit-autofill,
select:-webkit-autofill:hover,
select:-webkit-autofill:focus {
-webkit-background-clip: text;
-webkit-text-fill-color: #ffffff;
caret-color: #ffffff;
}

The W3C standards (here) only has the standards related to the autofill property (autocomplete), the kind of tokens we can use and the accessibility related to the auto-filled fields. In the W3C standards doesn't have any standard related to the styles applied in the auto-filled fields because each browser has their mechanism to provide the auto-filling suggestions and apply styles for the auto-filled fields.

Each browser has its technics to apply the styles for the auto-filled fields, usually in desktop browsers and some Mobile browsers is applied the styles using the autofill pseudo-class, in the mobile browsers which doesn't apply the CSS autofill pseudo-class, usually is added a custom attribute in the field to apply their styles (IOS Chrome, Android Browsers).

What changes do you think we should make in order to solve the problem?

Unfortunately for iOS mWeb Chrome and other WebView browsers we can't use only CSS to reset the Browser styles for auto-filled fields.

We should create a polyfill mechanism to provide the autofill styles for the input when the browsers can't apply the CSS autofill pseudo-class.

To provide the autofill styles (polyfill) we can create a custom hook which will responsible the return the autofill styles when the input is auto-filled and the browsers can't apply the CSS autofill pseudo-class.

For example,

const hasBrowserAutoFillStyles = ({initialStyles, input}) => {
    const currentInputStyles = getComputedStyle(input);

    return initialStyles.backgroundColor !== currentInputStyles.backgroundColor
}

const shouldApplyAutoFill = (autoFillContext) => {
    const {currentValue, previousValue, initialStyles, input} = autoFillContext;

    if (_.isEmpty(initialStyles) || !input) {
        return false;
    }

    const currentInputStyles = getComputedStyle(input);
    const digitDifference = currentValue.length - previousValue.length;

    return digitDifference > 1 || isInputAutoFilled(input) || hasBrowserAutoFillStyles(autoFillContext);
};

const useAutoFillStyles = (input) => {
    const styles = useThemeStyles();
    const currentValue = lodashGet(input, 'value', '');
    const previousValue = usePrevious(currentValue);
    const initialStyles = useMemo(() => {
        if (input) {
            const inputStyles = getComputedStyle(input);

            return {
                backgroundColor: inputStyles.backgroundColor,
            };
        }

        return {};
    }, [input]);

    const autoFillContext = {
        currentValue,
        previousValue,
        initialStyles,
        input,
    };

    return shouldApplyAutoFill(autoFillContext) ? styles.textInputAutofill : {};
};

We need to add autofill styles in the file styles.ts

textInputAutofill: {
    WebkitBackgroundClip: 'text',
    WebkitTextFillColor: '#ffffff',
    caretColor: '#ffffff',
},

What alternative solutions did you explore? (Optional)

N/A

@parasharrajat
Copy link
Member

I couldn't reproduce on a real device. @lanitochka17 @jliexpensify

@jliexpensify
Copy link
Contributor

@parasharrajat I don't have an Apple phone but I asked a colleague for the most recent version of iOS Chrome and she said it was 1.3.99 - I'm wondering if you're on that version and maybe that's why you can't repro?

@parasharrajat
Copy link
Member

parasharrajat commented Nov 17, 2023

OK, I can reproduce it now.


We don't have to create a prop for applying autofill styles. I think we want this behavior to be applied everywhere. I noticed that Chrome applied chrome-autofilled attribute on Chrome iOS. We should find a way to override all types of autofill attributes. There should be a standard way.

Thus we can just add style rules for it. @wlegolas How can we solve this problem in a standard way? Also, the problem was reported on Chrome iOS and your POC is created on the web.

Copy link

melvin-bot bot commented Nov 17, 2023

Triggered auto assignment to @neil-marcellini, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@parasharrajat
Copy link
Member

Taking my decision back until we finalize the proposal.

@parasharrajat
Copy link
Member

Waiting for more proposals which try to solve the problem for all types of autofills.

@wlegolas
Copy link
Contributor

OK, I can reproduce it now.

We don't have to create a prop for applying autofill styles. I think we want this behavior to be applied everywhere. I noticed that Chrome applied chrome-autofilled attribute on Chrome iOS. We should find a way to override all types of autofill attributes. There should be a standard way.

Thus we can just add style rules for it. @wlegolas How can we solve this problem in a standard way? Also, the problem was reported on Chrome iOS and your POC is created on the web.

Hi @parasharrajat, thank you for testing and letting me know about the behavior.

In my point of view, the main problem is that the mobile Chrome on iOS appears to use iOS's WKWebView, and WKWebView doesn't support non-standard webkit features. The support for WebKit feature is supported by the Blink engine, which is Chrome's rendering engine, that is the reason we are seeing this behavior on iOS mWeb Chrome.

WKWebView only supports features available to iOS Safari, if you see in the autofill support, we can see for "Safari on iOS" since version 15 this engine supports the CSS selector :autofill.

Unfortunately, I didn't have an iPhone to test it right now, that is the reason I tested using the Web browser to simulate the autofill using the plugin from my browser.

My thought is using :autofill could resolve this problem since the IOS has support for it.

I updated my proposal with the changes that should fix this behavior.

I'll test my proposal using Chrome on iOS and I'll bring the results.

@melvin-bot melvin-bot bot added the Overdue label Nov 20, 2023
@tienifr
Copy link
Contributor

tienifr commented Nov 20, 2023

Proposal

Please re-state the problem that we are trying to solve in this issue.

Email is entered but login field now has a white background

What is the root cause of that problem?

Chrome on iOS does not support the autofill pseudo class we used here because it's based on WKWebView, and autofill pseudo class is a non-standard webkit feature so WKWebView does not support it.

What changes do you think we should make in order to solve the problem?

Rely on the chrome-autofilled property being added to the input, to target the autofilled element on Chrome iOS.
We need to add

input[chrome-autofilled],
input[chrome-autofilled]:hover,
input[chrome-autofilled]:focus,
textarea[chrome-autofilled],
textarea[chrome-autofilled]:hover,
textarea[chrome-autofilled]:focus,
select[chrome-autofilled],
select[chrome-autofilled]:hover,
select[chrome-autofilled]:focus,

to before this line

For that new block, the logic is the same as what we have here, just that -webkit-autofill is replaced by [chrome-autofilled] to target the chrome-autofilled property in this scenario.

In here, we should add chrome-autofilled target as well.

What alternative solutions did you explore? (Optional)

We can optionally add a group of selectors with the :active as well if we want the autofill style to apply to the active input. Optional because this doesn't exist in current implementation in non-iOS Chrome.

I'm not sure if we provide standard support for browsers aside from Safari and Chrome, but if we do, might worth double check for those browser as well and apply the same method, if there's such browser with same issue, it will most likely add a prop to the input similar to the "chrome-autofilled". From my testing, Firefox does not seem to support autofill on iOS so doesn't have this problem.

@neil-marcellini
Copy link
Contributor

@jliexpensify I'm going to make you the internal owner of this issue until we actually have proposal to review.

@parasharrajat
Copy link
Member

@tienifr Web is open so we can't control the browsers users are using. We mainly focus on Chrome and Safari during testing as they are most used but solutions should always target all common platforms.

From standard, I meant to say support autofill across platforms. What if a different attribute is used for chrome on Android etc? What if the chrome-autofilled is experimental and changed to something else in the next release?

What does W3C say the standard is for autofill?

Copy link

melvin-bot bot commented Nov 21, 2023

@parasharrajat, @neil-marcellini, @jliexpensify Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@wlegolas
Copy link
Contributor

Proposal

Updated

@wlegolas
Copy link
Contributor

Hi @parasharrajat I tested my first proposal using only the autofill pseudo-class and didn't work for IOS Chrome.

After some studies, I realized that we can't fix this behavior only using CSS.

I updated my proposal with the changes to bring the autofill styles for Browsers that don't apply the autofill pseudo-class in the auto-filled field.

@jliexpensify
Copy link
Contributor

Not overdue, Rajat is looking at proposals.

@melvin-bot melvin-bot bot removed the Overdue label Nov 23, 2023
Copy link

melvin-bot bot commented Nov 23, 2023

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@neil-marcellini
Copy link
Contributor

Thanks, everyone for the proposals. I think that we should not add polyfills for this problem. Currently, we have one CSS-based solution that works. Because this problem is mainly occurring on iOS it is really important to have a setup for testing iOS. @wlegolas was very helpful during the discussion but they don't have a proper testing setup so we can go with @tienifr's proposal.

🎀 👀 🎀 C+ reviewed

Sounds good, assigning @tienifr

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Nov 30, 2023
Copy link

melvin-bot bot commented Nov 30, 2023

📣 @parasharrajat Please request via NewDot manual requests for the Reviewer role ($500)

Copy link

melvin-bot bot commented Nov 30, 2023

📣 @tienifr 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

Copy link

melvin-bot bot commented Nov 30, 2023

@parasharrajat @neil-marcellini @jliexpensify @tienifr this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

1 similar comment
Copy link

melvin-bot bot commented Nov 30, 2023

@parasharrajat @neil-marcellini @jliexpensify @tienifr this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

@jliexpensify
Copy link
Contributor

Damn Melvin, calm down.

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Daily KSv2 Weekly KSv2 labels Dec 1, 2023
@melvin-bot melvin-bot bot changed the title [$500] mWeb/Chrome - Login - Input field on Login page gets white background after using auto-fill [HOLD for payment 2023-12-15] [$500] mWeb/Chrome - Login - Input field on Login page gets white background after using auto-fill Dec 8, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Dec 8, 2023
Copy link

melvin-bot bot commented Dec 8, 2023

Reviewing label has been removed, please complete the "BugZero Checklist".

Copy link

melvin-bot bot commented Dec 8, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.9-5 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2023-12-15. 🎊

After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.

  • External issue reporter
  • Contributor that fixed the issue
  • Contributor+ that helped on the issue and/or PR

For reference, here are some details about the assignees on this issue:

Copy link

melvin-bot bot commented Dec 8, 2023

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

  • [@parasharrajat] The PR that introduced the bug has been identified. Link to the PR:
  • [@parasharrajat] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
  • [@parasharrajat] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
  • [@parasharrajat] Determine if we should create a regression test for this bug.
  • [@parasharrajat] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
  • [@jliexpensify] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Dec 14, 2023
@jliexpensify
Copy link
Contributor

Bump @parasharrajat to complete the checklist

@parasharrajat
Copy link
Member

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

  • [@parasharrajat] The PR that introduced the bug has been identified. Link to the PR: NA. Caused by browser.
  • [@parasharrajat] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment: NA
  • [@parasharrajat] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion: NA.
  • [@parasharrajat] Determine if we should create a regression test for this bug. Yes
  • [@parasharrajat] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.

Regression Test Steps

On mWeb-Chrome
  1. Go to staging.new.expenisfy.com
  2. On login page, enter email credentials using auto-fill from virtual keyboard.
  3. Observe that the email is entered without background.

Do you agree 👍 or 👎 ?

@jliexpensify
Copy link
Contributor

Payment Summary

Upwork job

@jliexpensify
Copy link
Contributor

Paid and job closed!

@parasharrajat
Copy link
Member

Payment requested as per #31415 (comment)

@JmillsExpensify
Copy link

$500 approved for @parasharrajat

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests

8 participants