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

Setup a11y: using the Tab key to select the language #15823

Merged
merged 8 commits into from
Oct 19, 2021
Merged

Setup a11y: using the Tab key to select the language #15823

merged 8 commits into from
Oct 19, 2021

Conversation

mishanthrop
Copy link
Contributor

@mishanthrop mishanthrop commented Sep 27, 2021

What does it do?

Improved keyboard navigation during language selection.

Why is it needed?

Because accesibility

How to test

  1. goto http://localhost/setup/?action=language
  2. use keyboard to select language and switch between popular and other.

Related issue(s)/PR(s)

modx_install_language_a11y

video by @Ibochkarev
https://user-images.githubusercontent.com/5341208/134926009-e72304cd-7c51-4d64-b250-3ffc78d00df8.mp4

@cla-bot cla-bot bot added the cla-signed CLA confirmed for contributors to this PR. label Sep 27, 2021
@Mark-H
Copy link
Collaborator

Mark-H commented Sep 27, 2021

Congrats on your first pull request :D

This seems like a step back semantically and (partially) accessibly.

When the language options are radio buttons (like they were), you can tab into the selected value and then use the arrow keys to navigate the different options. Turning them into buttons means they all can get focus, so you're going to have to tab through them all if you just want to get to the button for the next step. That would make it less accessible from an interaction point of view.

Semantically, as you're not performing an action, buttons isn't right either.

In the old situation there's no clear focus indicator, so it definitely makes sense to improve that to clarify where the user is currently, but definitely not with <button>.

@mishanthrop
Copy link
Contributor Author

@Mark-H thanks for review, I didn't take this moment into account.
Anyway, buttons "All languages" and "Only popular" are not focusable, so, I will be back with corrections :-)
Also I just tested this screen with a VoiceOver and it turned out be very verbose (VoiceOver reads all button text, eg "English English EN").

Copy link
Member

@opengeek opengeek left a comment

Choose a reason for hiding this comment

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

See notes from @Mark-H

@mishanthrop
Copy link
Contributor Author

@Mark-H, now this seems like a step forward semantically and (partially) accessibly :-)

Also fixed a bug for the case when the number of languages is a multiple of 4 (look at the right bottom).
image

@Mark-H
Copy link
Collaborator

Mark-H commented Sep 29, 2021

Great - I only have one comment from a code review for now, which is that the javascript seems be lacking the ; at the end of each line. Maybe I'm old and out of date on what the cool kids are doing these days, but... isn't the ; still required for vanilla (non-compiled) javascript?

Next step before getting a thumbs up is to test it which may lead to some further issues. That may take a little longer than a code review.

@mishanthrop
Copy link
Contributor Author

mishanthrop commented Sep 29, 2021

@Mark-H browser compatibility is a good question for disqussion.

Semicolon

In most cases, the semicolon is a matter of taste. I tested my code in the IE 11 and didn't find any semicolon related errors.

In general

As is mentioned on https://docs.modx.com/current/en/getting-started/server-requirements#browser-support-for-the-manager the Internet Explorer 11 is supported. Despite this, the some code contains unsupported API.

setup\templates\header.tpl

url = new URL(url_string)

But... https://developer.mozilla.org/en-US/docs/Web/API/URL/URL#browser_compatibility ¯\_(ツ)_/¯

Conclusion

The only unsupported thing in my code is forEach (I fixed this).
But I have more radical proposals.
I think it is necessary to globally revise the approach to the Frontend in the MODX 3 and start to write code in the ES6 and higher (using transpilers of course).
First, it will allow developers to write more concise and safer code.
Second, writing code using the old standard (ES5) is nostalgic demotivation. This is tantamount to using PHP4.
MODX already uses SASS instead of vanilla CSS. So why not do the same with JS (I'm not even talking about the TypeScript)?

@Mark-H
Copy link
Collaborator

Mark-H commented Sep 29, 2021

For sure, a discussion can be had about that (in an issue or the forum, not in a PR). Also worth keeping in mind the setup does not currently use the same build process as the manager.

Looks to me like that Url() syntax will need to be fixed then. ;)

@mishanthrop
Copy link
Contributor Author

Looks to me like that Url() syntax will need to be fixed then. ;)

I hope not in this PR

For sure, a discussion can be had about that (in an issue or the forum, not in a PR). Also worth keeping in mind the setup does not currently use the same build process as the manager.

I'll try to find resources to research current architecture and propose something.

@JoshuaLuckers
Copy link
Contributor

Looks to me like that Url() syntax will need to be fixed then. ;)

I hope not in this PR

It's indeed out of scope for this PR (however I don't think we need to fix it and just bump the browser requirements even although the documentations mentions the browser compatibility is for the manager).

@smg6511
Copy link
Collaborator

smg6511 commented Oct 2, 2021

@mishantrop - Just a reminder in terms of the ability to use ES6+, a PR that I authored (#15793) (that you commented on recently) was merged recently so the use of the newer js features you mention are available now. The js you see in the manager to date is all ES5-compliant because the old build workflow was incompatible with anything higher.

All - I'll start a thread in the forum under development re syntax style and link to it here soon. There are a couple thoughts I've been meaning to put out in that regard and we can address things like the semicolon question there as well.

@Ibochkarev Ibochkarev added feature Request about implementing a brand new function or possibility. pr/review-needed Pull request requires review and testing. labels Oct 12, 2021
@Ibochkarev Ibochkarev added this to the v3.0.0-alpha3 milestone Oct 12, 2021
@rthrash
Copy link
Member

rthrash commented Oct 12, 2021

This pull request has been mentioned on MODX Community. There might be relevant details there:

https://community.modx.com/t/thoughts-on-manager-code-style-includes-polls/4484/1

@Mark-H Mark-H requested a review from opengeek October 19, 2021 01:33
Copy link
Collaborator

@Mark-H Mark-H left a comment

Choose a reason for hiding this comment

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

Looks good, works as advertised.

@Mark-H Mark-H dismissed opengeek’s stale review October 19, 2021 01:34

Changes made

@Mark-H Mark-H added pr/ready-for-merging Pull request reviewed and tested and ready for merging. and removed pr/review-needed Pull request requires review and testing. labels Oct 19, 2021
@opengeek
Copy link
Member

Please do not include the compiled CSS in the PRs you submit in the future.

@opengeek opengeek merged commit 626fc90 into modxcms:3.x Oct 19, 2021
@mishanthrop
Copy link
Contributor Author

Please do not include the compiled CSS in the PRs you submit in the future.

I'll remember that.

P.S.
These files were already stored in the repository. There is no information that they should not be there. Since these files should not be in the repository, need to add them to the .gitignore and remove them from the repository.

@opengeek
Copy link
Member

opengeek commented Oct 19, 2021

They have to be in the repository. Just like the CSS for the manager, these have to be compiled from the SCSS when merging or testing a PR. If you include the compiled changes to them in the PR, then they will potentially conflict with changes to those files from other PRs.

@mishanthrop
Copy link
Contributor Author

Did not know about such CI-related details, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed CLA confirmed for contributors to this PR. feature Request about implementing a brand new function or possibility. pr/ready-for-merging Pull request reviewed and tested and ready for merging.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants