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

[feature]: Replace ProductQuantity on Product Page with QuantityFields stepper #2690

Merged
merged 9 commits into from Oct 1, 2020
Merged

[feature]: Replace ProductQuantity on Product Page with QuantityFields stepper #2690

merged 9 commits into from Oct 1, 2020

Conversation

huykon
Copy link
Contributor

@huykon huykon commented Sep 9, 2020

Description

The quantity selector on PDP and cart don't currently match either in the way they look or in the way they behave.

The cart stepper is the latest design, and the quantity selector on PDP should be updated to match this.

Related Issue

Closes #2679.

Acceptance

Verification Stakeholders

@tjwiebell

Specification

Verification Steps

  1. Go to the PDP.
  2. Verify the quantity field is QuantityFields.

Screenshots / Screen Captures (if appropriate)

Checklist

  • I have added tests to cover my changes, if necessary.
  • I have updated the documentation accordingly, if necessary.

@PWAStudioBot
Copy link
Contributor

PWAStudioBot commented Sep 9, 2020

Fails
🚫 A version label is required. A maintainer must add one.
Messages
📖

Access a deployed version of this PR here. Make sure to wait for the "pwa-pull-request-deploy" job to complete.

📖 DangerCI Failures related to missing labels/description/linked issues/etc will persist until the next push or next nightly build run (assuming they are fixed).

Generated by 🚫 dangerJS against d00884a

@schensley
Copy link

@huykon while this work does make the "stepper" quantity control more consistent with the control as it exists in cart, that its size (width) seems to only be restricted by the with of the area it exists in can present a bit of a problem in terms of recognition of the control or user expectations (see screen shot).
At some sizes it appears that that quantity control may expand to such a degree that

  1. it's hard to recognize it as a means for setting the quantity (recognition) and
  2. separates the "increase" and "decrease" buttons to a degree that can make for a less efficient UI.
    I would recommend placing some restrictions to the width of this such that it will appear to accommodate a typical and reasonable quantity (if a shopper is likely to purchase quantities in the hundreds then it should look like a 3-digit number would fit). The "right" size might be a matter of opinion or aesthetics, but generally speaking there is a "shape" that most users recognize.
    Also, just a question about the values that appear in the drop down when you click into the quantity field, I am assuming these are meant to be configurable, but some thought might be given to the height of the drop down container that it would fit within the viewport should it provide an long (infinite?) list of numbers.
    Thanks.
    Screen Shot 2020-09-21 at 10 53 50 AM

@huykon
Copy link
Contributor Author

huykon commented Sep 22, 2020

@schensley Thank for your comment so what should I do now:

  • Reduce the width of quantity box
  • limit the max number to quantity input
    Please give me your feedback!

Comment on lines 172 to 173
grid-template-columns: auto 1fr auto;
padding: 0 1rem;
Copy link
Contributor

Choose a reason for hiding this comment

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

@huykon - I would suggest this change given @schensley's feedback on sizing. This is no longer a dropdown, so I don't think anything else needs changed other than the width.

Suggested change
grid-template-columns: auto 1fr auto;
padding: 0 1rem;
grid-template-columns: auto 4rem auto;
justify-content: start;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have just updated code as your recommend.

@m2-community-project m2-community-project bot moved this from Ready for Review to Review in Progress in Pull Request Progress Sep 22, 2020
@schensley
Copy link

HI @huykon sorry I didn't get back to you, but it looks like you've done an excellent job. Thanks. UX approved.

@huykon
Copy link
Contributor Author

huykon commented Sep 25, 2020

@schensley thank you

tjwiebell
tjwiebell previously approved these changes Sep 28, 2020
Copy link
Contributor

@tjwiebell tjwiebell left a comment

Choose a reason for hiding this comment

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

Change looks good 👍 ProductQuantity can safely be deprecated now, but I'll create a followup to make QuantityStepper @api and deprecate that old guy. Nice work!

@dpatil-magento
Copy link
Contributor

@huykon @tjwiebell Let me know if we need to create follow up tickets or these needs to be handled here -

  1. When user enter qty greater than available, no error is shown to user even though graphql returns it

  1. Might just be a QA flow :) if user enters 0 in qty field then good to enable + stepper and disable Add to Cart button?

@huykon
Copy link
Contributor Author

huykon commented Sep 30, 2020

@dpatil-magento I will wait the confirmation from @tjwiebell to decide whether we should update or not. Thanks for your reporting

@tjwiebell
Copy link
Contributor

tjwiebell commented Sep 30, 2020

@dpatil-magento I will wait the confirmation from @tjwiebell to decide whether we should update or not. Thanks for your reporting

  1. Great catch @dpatil-magento - these errors are not getting passed to the QuantityStepper, which doesn't appear to have error handling even if we were. This should be resolved in this scope.

@huykon - Let's add an optional message prop to QuantityFields and dependently render a message element if truthy. It should auto flow to the next row given the grid, so you should just need grid-column-end: span 3; (and maybe justify-self: start so it's left aligned). Use previous rendering as a guide.

Screen Shot 2020-09-30 at 8 34 32 AM

  1. This is simple and should be fixed, just pass min={1} prop to QuantityFields

@huykon
Copy link
Contributor Author

huykon commented Sep 30, 2020

I have just updated. Please check again @tjwiebell @dpatil-magento

Copy link
Contributor

@tjwiebell tjwiebell left a comment

Choose a reason for hiding this comment

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

Tiny change to make this more consistent with the code base then this looks good to go 🚀

tjwiebell
tjwiebell previously approved these changes Sep 30, 2020
@dpatil-magento
Copy link
Contributor

Thanks @huykon @tjwiebell , there are still some breaking flows -

2 (continuing) - Make qty blank and click outside (I think at this step only good to make qty display back to 1) and enter 01 which turns to 11 and now click add to cart button, user see the error.
Image from Gyazo

3 - Add an item to cart and then increase the qty and directly (keeping cursor in qty field only) hit Add to cart again - Previous qty being added agian and not newly entered one
Image from Gyazo

@dpatil-magento
Copy link
Contributor

QA Approved.

Copy link
Contributor

@sirugh sirugh left a comment

Choose a reason for hiding this comment

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

One comment but I won't hold the PR up on it as I don't have context around discussions with UX on this change.

@@ -29,41 +30,46 @@ export const QuantityFields = props => {
maskInput
} = talonProps;

const errorMessage = message ? <Message>{message}</Message> : null;
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks good - my only concern is that the message is a bit close to the field and not red.

Copy link
Contributor

Choose a reason for hiding this comment

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

We stuck with the same UX from the dropdown treatment, which you recently implemented 😉 it looks pretty identical to me.

#2690 (comment)

@m2-community-project m2-community-project bot moved this from Review in Progress to Reviewer Approved in Pull Request Progress Oct 1, 2020
@@ -12,7 +12,7 @@ import Button from '../Button';
import Carousel from '../ProductImageCarousel';
import FormError from '../FormError';
import { fullPageLoadingIndicator } from '../LoadingIndicator';
import Quantity from '../ProductQuantity';
Copy link
Contributor

Choose a reason for hiding this comment

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

Oh also, can we throw a @deprecated label on the old ProductQuantity component? After this PR it will only be used in the legacy mini cart.

Copy link
Contributor

Choose a reason for hiding this comment

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

There were two things I wanted to do as a followup, prefer to just merge this:

#2690 (review)

Copy link
Contributor

Choose a reason for hiding this comment

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

Created PWA-960, thanks for the reminder; would have missed actually creating that in the backlog.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@tjwiebell please mention to me when you create that issue. I hope I can resolve that :D

@tjwiebell tjwiebell added the version: Major This changeset includes incompatible API changes and its release necessitates a Major version bump. label Oct 1, 2020
Copy link
Contributor

@tjwiebell tjwiebell left a comment

Choose a reason for hiding this comment

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

Do I have write access to approve?

@dpatil-magento dpatil-magento merged commit 0a3ec3e into magento:develop Oct 1, 2020
@m2-community-project m2-community-project bot moved this from Reviewer Approved to Done in Pull Request Progress Oct 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg:peregrine pkg:venia-ui Progress: done version: Major This changeset includes incompatible API changes and its release necessitates a Major version bump.
Development

Successfully merging this pull request may close these issues.

[feature]: Replace ProductQuantity on Product Page with QuantityFields stepper
6 participants