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

Update price.liquid HTML structure #662

Merged
merged 2 commits into from
Oct 5, 2021
Merged

Update price.liquid HTML structure #662

merged 2 commits into from
Oct 5, 2021

Conversation

LucasLacerdaUX
Copy link
Contributor

@LucasLacerdaUX LucasLacerdaUX commented Sep 21, 2021

Why are these changes introduced?
Updates the markup for Product price to feature valid/accessible HTML structure.

Fixes #74.

What approach did you take?
Followed suggestions on #74:

Due to rethinking on list heuristics from the accessibility community, and the fact that there are no visuals indicating list content, let's remove the dl semantic elements. This will provide valid HTML and remove extra announcements of list and list item count which is not required in this context.

Demo links

Checklist

@svinkle
Copy link
Member

svinkle commented Sep 28, 2021

@LucasLacerdaUX store demo link is broken.

@LucasLacerdaUX LucasLacerdaUX marked this pull request as ready for review September 28, 2021 14:07
@LucasLacerdaUX
Copy link
Contributor Author

LucasLacerdaUX commented Sep 28, 2021

@svinkle Sorry about that - I had this as a draft and forgot to update the PR status & description 🤦‍♂️

The PR is now ready for review and I've updated the preview links:

@KaichenWang KaichenWang self-requested a review September 28, 2021 14:34
KaichenWang
KaichenWang previously approved these changes Sep 28, 2021
Copy link
Contributor

@KaichenWang KaichenWang left a comment

Choose a reason for hiding this comment

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

The markup refactor mostly looks good. Left a comment regarding invalid HTML.

<dt class="visually-hidden">{{ 'products.product.price.unit_price' | t }}</dt>
<dd {% if show_badges == false %}class="price__last"{% endif %}>
<span class="visually-hidden">{{ 'products.product.price.unit_price' | t }}</span>
<div class="price-item price-item--last">
Copy link
Contributor

Choose a reason for hiding this comment

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

According to docs on permitted content of <small> element, <div> is technically not a valid child here

Copy link
Member

Choose a reason for hiding this comment

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

Good catch.

Copy link
Contributor Author

@LucasLacerdaUX LucasLacerdaUX Sep 28, 2021

Choose a reason for hiding this comment

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

Updated to use span and added a display: block to the unit-price element to keep the original layout.

Let me know if that works :)

EDIT: Forgot to push the commit. Code is now updated.

<dt class="visually-hidden">{{ 'products.product.price.unit_price' | t }}</dt>
<dd {% if show_badges == false %}class="price__last"{% endif %}>
<span class="visually-hidden">{{ 'products.product.price.unit_price' | t }}</span>
<div class="price-item price-item--last">
<span>{{- product.selected_or_first_available_variant.unit_price | money -}}</span>
<span aria-hidden="true">/</span>
<span class="visually-hidden">&nbsp;{{ 'accessibility.unit_price_separator' | t }}&nbsp;</span>
Copy link
Member

Choose a reason for hiding this comment

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

Could we adjust this string? The uppercase may render "P-E-R" when announced by screen readers. Removing the uppercase announces as expected but still may not be clear. Can we consider "for every" or "for each"?
/cc @gretchen-willenberg

Copy link
Contributor

Choose a reason for hiding this comment

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

@svinkle cc'ing @melissaperreault to consult on the user of uppercase design. From a text perspective, "per" is used as as part of a product resource Cost per item label (attached). In Dawn, the only setting use was the Collection product grid setting (attached).

I'm fine with Products on a page for Collection setting, but the string above seems to be pricing. We should request updating it in the product resources as well. Unit price would be shorter and is used (although a bit B2B)

Screen Shot 2021-09-28 at 3 18 44 PM

Screen Shot 2021-09-28 at 3 19 31 PM

Copy link
Member

Choose a reason for hiding this comment

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

This bit of content is visually hidden so there'd be no visual change, only how the content is announced.

Let's keep the content as-is for now, perhaps address in another PR. I'm keen to have usability testing done with Fable soon. If this comes up as an issue we can revisit then.

svinkle
svinkle previously approved these changes Sep 28, 2021
Copy link
Member

@svinkle svinkle left a comment

Choose a reason for hiding this comment

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

Works well!

@ludoboludo ludoboludo self-requested a review October 5, 2021 16:36
Copy link
Contributor

@ludoboludo ludoboludo left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

</div>
<div class="price__sale">
<dt class="price__compare">
{%- unless product.price_varies == false and product.compare_at_price_varies %}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
{%- unless product.price_varies == false and product.compare_at_price_varies %}
{%- unless product.price_varies == false and product.compare_at_price_varies -%}

@LucasLacerdaUX LucasLacerdaUX merged commit 37c1c64 into main Oct 5, 2021
@LucasLacerdaUX LucasLacerdaUX deleted the price-structure branch October 5, 2021 19:13
@ludoboludo ludoboludo mentioned this pull request Oct 22, 2021
5 tasks
phapsidesGT pushed a commit to Gravytrain-UK/gt-shopify-dawn-theme that referenced this pull request Sep 3, 2024
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.

[Product] Price content incorrect HTML structure
5 participants