Skip to content

Conversation

@vedanshujain
Copy link
Contributor

@vedanshujain vedanshujain commented Nov 15, 2021

All Submissions:

Changes proposed in this Pull Request:

Autocomplete is defaulted to on in most browsers, this is usually fine, but Firefox will overwrite the actual value with whatever user-entered last. This means if we change the quantity in some other page, and then refresh the cart page, the last entered value in the cart page will be displayed, overwriting the actual value passed by the server.

So autocomplete is disabled by default for the quantity input field, further a filter is added like other fields in case this needs to be modified.

Closes #30733.

How to test the changes in this Pull Request:

From #30733:

  1. Add a product to your cart. There must be at least 2 of these products available.
  2. Visit the cart page and modify the quantity of the item. Update the cart and confirm the quantity has been updated and that the item is still in your cart.
  3. In a separate tab, visit the product page and add the product to your cart again. This must be the same product (and, if applicable, the same variation) you previously modified.
  4. Refresh the original tab. The cart should now have updated totals reflecting the action taken in step 3. The quantity input will also be correct if this patch is applied. Without this patch, you will still see the old quantity value.

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully run tests with your changes locally?

Changelog entry

Tweak - Disable autocomplete on quantity input field to prevent stale values in Firefox.

FOR PR REVIEWER ONLY:

  • I have reviewed that everything is sanitized/escaped appropriately for any SQL or XSS injection possibilities. I made sure Linting is not ignored or disabled.

Autocomplete is default to on in most browsers, this is usually fine, but FireFox will overwrite actual value with whatever user entered last. This means if we change the quanity in some other page, and then refresh the cart page, the last entered value in cart page will be displayed, overwriting the actual value passed by server.

So autcomplete is disabled by default for quanity input field, further a filter is added like other fields in case this needs to be modified.
@vedanshujain vedanshujain requested review from a team and barryhughes and removed request for a team November 15, 2021 08:29
Copy link
Member

@barryhughes barryhughes 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 verifying tests locally before merge, if I can, since we have some issues with checks on GH atm.

@barryhughes barryhughes merged commit be1c879 into trunk Nov 16, 2021
@barryhughes barryhughes deleted the fix/30733 branch November 16, 2021 01:30
@barryhughes barryhughes added release: add changelog Mark all PRs that have not had their changelog entries added. [auto] release: add testing instructions PRs that have not had testing instructions added to the wiki. [auto] labels Nov 16, 2021
@github-actions github-actions bot added this to the 6.0.0 milestone Nov 16, 2021
@github-actions
Copy link
Contributor

github-actions bot commented Nov 16, 2021

Hi @barryhughes, thanks for merging this pull request. Please take a look at these follow-up tasks you may need to perform:

  • Add the status: needs changelog label
  • Add the status: needs testing instructions label

@ObliviousHarmony ObliviousHarmony added changelog added and removed release: add changelog Mark all PRs that have not had their changelog entries added. [auto] labels Nov 21, 2021
@rodelgc rodelgc added testing instructions added and removed release: add testing instructions PRs that have not had testing instructions added to the wiki. [auto] labels Nov 23, 2021
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.

Cart quantities can appear incorrectly after modification

5 participants