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

[Header] No-js behaviour for locale selectors #2485

Merged
merged 3 commits into from
Apr 7, 2023
Merged

Conversation

ludoboludo
Copy link
Contributor

@ludoboludo ludoboludo commented Apr 3, 2023

PR Summary:

Adding the locale selector for the no-js behaviour in the header

Why are these changes introduced?

Fixes #2262

What approach did you take?

In the original PR, the no script behaviour was there at first so I re added it with some extra styling tweaks.

Other considerations

Visual impact on existing themes

Visual impact only on the no JS environment which is a very niche use case.

Testing steps/scenarios

  • Make sure the locale selectors are enabled in the header
  • then disable JS in for your browser tab/window and make sure the local selectors are still coming up and working as expected. (To disable JS in chrome, you can right click on the page then Inspect, click on the settings wheel in the inspect tool, scroll all the way to the bottom and find the Debugger > Disable JavaScript

Demo links

Checklist

@eugenekasimov eugenekasimov self-requested a review April 3, 2023 19:20
Copy link
Contributor

@stufreen stufreen left a comment

Choose a reason for hiding this comment

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

LGTM. It really makes the header big, but it works!

<noscript class="small-hide medium-hide">
{%- form 'localization', id: 'HeaderCountryMobileFormNoScript', class: 'localization-form' -%}
<div class="localization-form__select">
<h2 class="visually-hidden" id="HeaderCountryMobileLabelNoScript">{{ 'localization.country_label' | t }}</h2>
Copy link
Contributor

Choose a reason for hiding this comment

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

Why h2 and not a label?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reusing the approach from the footer and also what's in the JS approach. I believe the reason why is because it helps navigate to it more easily when using a screen reader and using the VoiceOver rotor which shows you all the page's headings.

{%- form 'localization', id: 'HeaderCountryForm', class: 'localization-form' -%}
<div class="no-js-hidden">
Copy link
Contributor

Choose a reason for hiding this comment

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

Non blocking but just curious: do you know why no-js-hidden was on the inner div before?

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'm not sure tbh. If I left it the way it was, I'd get some unwanted space around the selectors. It's like that in the footer, so I think it was mostly copied over.
I can't really think of a reason why it wouldn't be on the parent 🤔

Copy link
Contributor

@eugenekasimov eugenekasimov left a comment

Choose a reason for hiding this comment

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

The arrow buttons inside of the selector container are not clickable. Although UX in general isn't great without JS this small issue might be worth to fix. 🤔
Here is a video.

@ludoboludo
Copy link
Contributor Author

Yeah I've noticed this too @eugenekasimov. I think it's ok as is. It's the same behaviour we've had for the locale selectors in the footer. 🤷

@melissaperreault melissaperreault self-requested a review April 4, 2023 18:41
Copy link
Contributor

@melissaperreault melissaperreault left a comment

Choose a reason for hiding this comment

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

Thanks Ludo!

Not a blocker

  • I did find the selectors pretty wide but I guess this is due to the longest option in the list. The only thing I noticed is that the focus is shorter compared to the component's width (Visual reference)

@ludoboludo ludoboludo merged commit e64bc00 into main Apr 7, 2023
@ludoboludo ludoboludo deleted the no-js-header-locales branch April 7, 2023 14:48
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.

[Header] Localization selectors follow up for no-js
4 participants