EvgeniyMukhamedjanov / liquid-ajax-cart

Build a Shopify Ajax-cart without JavaScript coding
https://liquid-ajax-cart.js.org
194 stars 22 forks source link

Style cart errors #77

Closed driespieters closed 1 year ago

driespieters commented 1 year ago

After upgrading to v2 I noticed the css classes js-ajax-cart-message and js-ajax-cart-message--error are no longer available. This makes it hard to apply a nice looking error message.

Targetting[data-ajax-cart-errors] like the demo does is a bit to limited as adding margin, padding, background color is not possible without it being visible.

Suggestion: Add aria-hidden attribute to [data-ajax-cart-errors] and set false when the error message is active. (There is a aria-errormessage as well, but not sure if it's applicable here) Perhaps also mention removal in migration docs.

Thanks again for this repo!

EvgeniyMukhamedjanov commented 1 year ago

Hey @driespieters Didn't know that classes are used :-) I personally never used the classes, instead I suggest to do this:

[data-ajax-cart-error] {
  /* Message is active */
}

[data-ajax-cart-error]:empty {
  /* Message is off */
}

Let me know if that works for you. Otherwise I'll think about aria-hidden or even just hidden attr for that.

driespieters commented 1 year ago

That's a good idea. Didn't think of that selector! Thank you.