Skip to content
This repository has been archived by the owner on Oct 20, 2023. It is now read-only.

[Discussion] Create a separate package for "good practices" #65

Open
NathanPJF opened this issue Nov 12, 2018 · 0 comments
Open

[Discussion] Create a separate package for "good practices" #65

NathanPJF opened this issue Nov 12, 2018 · 0 comments

Comments

@NathanPJF
Copy link
Contributor

Background: There was a recent PR that looked to add back a method to theme-cart that checked for cookies #63. It was decided not to include the method because it wasn't about interacting with Shopify's cart API.

Discussion

I feel it is useful to have a method available to see whether cookies are enabled as part of theme-scripts since cookies are required to build a cart in Shopify. It is a good practice for any theme developer to implement some behaviour when cookies are disabled. For example: On the Themes team at Shopify, we display a warning message in the cart when cookies are disabled. Alternatively, in this PR it was mentioned that a theme could save a cart object in localstorage.

For this conversation, it's not about what a theme should do when cookies are disabled, but rather that a check for cookies is a good practice that devs should be considering. So how should we be capturing these good practices? Or should we at all?

I'd argue that we already provide a collection of "good practice" methods in theme-rte and theme-a11y. These scripts don't help with Shopify-specific things, like dealing with the Cart API as seen in theme-cart, or handling a product JSON object seen in theme-product; but they are useful to the community nonetheless in building responsive and accessible themes.

Suggestion

Perhaps we should create a "theme utilities" package that has a bunch of methods that are good web development practice. For a start: this could collapse theme-rte and theme-a11y into the same general web dev package.

This would send a clearer signal that packages are for handling Shopify-specific considerations, except for this one theme-utils package that is best practices.

The theme-rte package is only handling responsive iframes and tables. It's "Shopify specific" in as far as it is a good safety measure for merchants uploading <iframe> and <table> elements into the RTE. However, the accessibleLinks method of theme-a11y does something similar by making sure any link has proper descriptions for screen readers - which is great for links inserted via an RTE.

cc @jonathanmoore @wizardlyhel @t-kelly

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant