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: make autofill work for controlled input in Firefox #2698

Merged
merged 7 commits into from
May 2, 2022

Conversation

pudek357
Copy link
Contributor

@pudek357 pudek357 commented Apr 28, 2022

SPT-2611

Description

There is an issue in React that breaks Firefox browser behavior for autofill/autocomplete in controlled inputs.
mui/material-ui#16943
facebook/react#15739
facebook/react#18986

The solution is taken from one of the comment:
facebook/react#18986 (comment)

How to test

  • open Firefox

  • go to https://codesandbox.io/s/withered-worker-0njelw (latest Picasso)

  • add some values for plain and controlled Picasso input and submit the form

  • check autofill for each input, you will notice that Picasso input will not have any autofill options

  • firefox_ntFge3HuoA_Trim.mp4
  • go to https://picasso.toptal.net/SPT-2611-fix-autofill-for-firefox/?path=/story/picasso-forms-final-form--final-form

  • edit code

  • Use this code to test it:
    function App() {
      const onSubmit = async (values: any, form: any) => {
        form.submit();
        return new Promise((resolve) => setTimeout(resolve, 100));
      };
    
      return (
        <Picasso>
          <Container flex direction="column" alignItems="center" top="medium">
            <Form onSubmit={onSubmit}>
              <Container bottom="small">
                <input
                  type="text"
                  name="plainInput_PicassoWithFix"
                  autoComplete="on"
                />
              </Container>
    
              <Container bottom="small">
                <Form.Input
                  type="text"
                  name="controlledInput_PicassoWithFix"
                  autoComplete="on"
                />
              </Container>
    
              <Form.SubmitButton>submit</Form.SubmitButton>
            </Form>
          </Container>
        </Picasso>
      );
    }
  • add some values for plain and controlled Picasso input and submit the form

  • check autofill for each input

  • autofill should work for both inputs

Development checks

Breaking change

  • n/a codemod is created
  • n/a test alpha package of Picasso in StaffPortal
PR commands

List of available commands:

  • @toptal-bot run all - Run whole pipeline
  • @toptal-bot run build - Check build
  • @toptal-bot run visual - Run visual tests
  • @toptal-bot run deploy:documentation - Deploy documentation
  • @toptal-bot run package:alpha-release - Release alpha version
PR Review Guidelines

When to approve? ✅

You are OK with merging this PR and

  1. You have no extra requests.
  2. You have optional requests.
    1. Add nit: to your comment. (ex. nit: I'd rename this variable from makeCircle to getCircle)

When to request changes? ❌

You are not OK with merging this PR because

  1. Something is broken after the changes.
  2. Acceptance criteria is not reached.
  3. Code is dirty.

When to comment (neither ✅ nor ❌)

You want your comments to be addressed before merging this PR in cases like:

  1. There are leftovers like unnecessary logs, comments, etc.
  2. You have an opinionated comment regarding the code that requires a discussion.
  3. You have questions.

How to handle the comments?

  1. An owner of a comment is the only one who can resolve it.
  2. An owner of a comment must resolve it when it's addressed.
  3. A PR owner must reply with ✅ when a comment is addressed.

@pudek357 pudek357 added the Bugfix Something isn't working label Apr 28, 2022
@pudek357 pudek357 self-assigned this Apr 28, 2022
@changeset-bot
Copy link

changeset-bot bot commented Apr 28, 2022

🦋 Changeset detected

Latest commit: 4a53f8a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@toptal/picasso-forms Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@toptal-devbot
Copy link
Collaborator

Your alpha package is ready 🎉
yarn add @toptal/picasso-charts@35.1.2-alpha-SPT-2611-fix-autofill-for-firefox.26
yarn add @toptal/picasso-codemod@5.2.1-alpha-SPT-2611-fix-autofill-for-firefox.36
yarn add @toptal/picasso-forms@42.2.1-alpha-SPT-2611-fix-autofill-for-firefox.13
yarn add @toptal/picasso-provider@1.1.1-alpha-SPT-2611-fix-autofill-for-firefox.36
yarn add @toptal/picasso@22.3.2-alpha-SPT-2611-fix-autofill-for-firefox.3
yarn add @toptal/picasso-shared@8.1.1-alpha-SPT-2611-fix-autofill-for-firefox.36
yarn add @topkit/analytics-charts@32.1.1-alpha-SPT-2611-fix-autofill-for-firefox.36

@toptal-devbot
Copy link
Collaborator

Your alpha package is ready 🎉
yarn add @toptal/picasso-charts@35.1.2-alpha-SPT-2611-fix-autofill-for-firefox.27
yarn add @toptal/picasso-codemod@5.2.1-alpha-SPT-2611-fix-autofill-for-firefox.37
yarn add @toptal/picasso-forms@42.2.1-alpha-SPT-2611-fix-autofill-for-firefox.14
yarn add @toptal/picasso-provider@1.1.1-alpha-SPT-2611-fix-autofill-for-firefox.37
yarn add @toptal/picasso@22.3.2-alpha-SPT-2611-fix-autofill-for-firefox.4
yarn add @toptal/picasso-shared@8.1.1-alpha-SPT-2611-fix-autofill-for-firefox.37
yarn add @topkit/analytics-charts@32.1.1-alpha-SPT-2611-fix-autofill-for-firefox.37

@toptal-devbot
Copy link
Collaborator

Your alpha package is ready 🎉
yarn add @toptal/picasso-charts@35.1.2-alpha-SPT-2611-fix-autofill-for-firefox.28
yarn add @toptal/picasso-codemod@5.2.1-alpha-SPT-2611-fix-autofill-for-firefox.38
yarn add @toptal/picasso-forms@42.2.1-alpha-SPT-2611-fix-autofill-for-firefox.15
yarn add @toptal/picasso-provider@1.1.1-alpha-SPT-2611-fix-autofill-for-firefox.38
yarn add @toptal/picasso@22.3.2-alpha-SPT-2611-fix-autofill-for-firefox.5
yarn add @toptal/picasso-shared@8.1.1-alpha-SPT-2611-fix-autofill-for-firefox.38
yarn add @topkit/analytics-charts@32.1.1-alpha-SPT-2611-fix-autofill-for-firefox.38

@pudek357 pudek357 force-pushed the SPT-2611-fix-autofill-for-firefox branch from ef72e92 to 9491076 Compare April 28, 2022 10:37
@toptal-devbot
Copy link
Collaborator

Your alpha package is ready 🎉
yarn add @toptal/picasso-charts@35.1.2-alpha-SPT-2611-fix-autofill-for-firefox.30
yarn add @toptal/picasso-codemod@5.2.1-alpha-SPT-2611-fix-autofill-for-firefox.40
yarn add @toptal/picasso-forms@42.2.1-alpha-SPT-2611-fix-autofill-for-firefox.17
yarn add @toptal/picasso-provider@1.1.1-alpha-SPT-2611-fix-autofill-for-firefox.40
yarn add @toptal/picasso@22.3.2-alpha-SPT-2611-fix-autofill-for-firefox.7
yarn add @toptal/picasso-shared@8.1.1-alpha-SPT-2611-fix-autofill-for-firefox.40
yarn add @topkit/analytics-charts@32.1.1-alpha-SPT-2611-fix-autofill-for-firefox.40

@pudek357 pudek357 marked this pull request as ready for review April 28, 2022 14:58
@pudek357 pudek357 requested a review from a team as a code owner April 28, 2022 14:58
@toptal-devbot
Copy link
Collaborator

Greetings from FX team, @pudek357 👋

Thank you so much for contributing 🙇

We have got high priority ticket generated on our Kanban board so we will do our best to make your experience supreme!

What's next? We will collaborate using this workflow. For you this practically means making sure DONE criteria is met and responding promptly to code review comments 😉

🙏 please, help us improve, rate your contributing experience after merge

@github-actions github-actions bot added the contribution DO NOT ADD MANUALLY label Apr 28, 2022
Copy link
Contributor

@LashaJini LashaJini left a comment

Choose a reason for hiding this comment

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

Tested on Firefox, works as expected. Awesome how to test in description 👍

.changeset/polite-apricots-drive.md Outdated Show resolved Hide resolved
@the-teacher
Copy link
Contributor

the-teacher commented Apr 29, 2022

Chrome on/off
Screen Shot 2022-04-29 at 17 02 57
Screen Shot 2022-04-29 at 17 02 48

@the-teacher
Copy link
Contributor

the-teacher commented Apr 29, 2022

FF on/on
@pudek357 I do not like this case. In FF both cases have on, but the autocomplete is visible only for the first input. Is it fine?

Screen Shot 2022-04-29 at 17 06 15

Screen Shot 2022-04-29 at 17 06 37

@the-teacher
Copy link
Contributor

Chrome on/on
Screen Shot 2022-04-29 at 17 08 07
Screen Shot 2022-04-29 at 17 08 48

@pudek357 pudek357 force-pushed the SPT-2611-fix-autofill-for-firefox branch from 9491076 to bbb4178 Compare May 2, 2022 02:42
@pudek357
Copy link
Contributor Author

pudek357 commented May 2, 2022

@toptal-bot run all

@the-teacher
Copy link
Contributor

I have it checked on FF with on/off options on the last available Picasso version.
Now it looks good!

Screen Shot 2022-05-02 at 09 52 38

Screen Shot 2022-05-02 at 09 52 28

Screen Shot 2022-05-02 at 09 53 23

Copy link
Contributor

@the-teacher the-teacher left a comment

Choose a reason for hiding this comment

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

Tested manually! Looks great!

@pudek357
Copy link
Contributor Author

pudek357 commented May 2, 2022

@toptal-bot run all

Copy link
Collaborator

@denieler denieler left a comment

Choose a reason for hiding this comment

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

right now we have below 4% of users who use Firefox. Do you think it's an important fix to introduce?

@sashuk
Copy link
Contributor

sashuk commented May 2, 2022

Hello, @denieler! Regarding #2698 (review) – I think we do need this fix, as it was reported by actual users (this affects the Screening Ops team work, for example (https://toptal-core.slack.com/archives/C01ANC5RH8B/p1650458144649619)

@pudek357
Copy link
Contributor Author

pudek357 commented May 2, 2022

@toptal-bot run all

Copy link
Contributor

@OndrejTuma OndrejTuma left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@augustobmoura augustobmoura left a comment

Choose a reason for hiding this comment

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

Manual tested and it works great! 👍

Copy link
Collaborator

@denieler denieler left a comment

Choose a reason for hiding this comment

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

Checked the code, it looks ok 👍 Haven't tested manually 🙇‍♂️

@toptal-devbot
Copy link
Collaborator

🎉 Last commit is successfully deployed 🎉

Demo is available on:

Your davinci-bot 🚀

@pudek357 pudek357 merged commit 2f85d8f into master May 2, 2022
@pudek357 pudek357 deleted the SPT-2611-fix-autofill-for-firefox branch May 2, 2022 14:45
@toptal-build toptal-build mentioned this pull request May 2, 2022
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bugfix Something isn't working contribution DO NOT ADD MANUALLY
Projects
None yet
10 participants