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

Accessibility review: Mode switcher onChange handler #392

Closed
aduth opened this issue Apr 10, 2017 · 16 comments
Closed

Accessibility review: Mode switcher onChange handler #392

aduth opened this issue Apr 10, 2017 · 16 comments
Labels
[Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). Needs Design Needs design efforts. [Type] Question Questions about the design or development of the editor.

Comments

@aduth
Copy link
Member

aduth commented Apr 10, 2017

In the course of #389, our accessibility lint rules hinted to a guideline relating to select change handlers:

The gist of the recommendation is that keyboard navigating select inputs may cause an onChange to fire more frequently than expected in some browsers.

In our case, we decided to disable the rule with reasoning reflected in an inline comment:

Disable reason: Toggling between modes should take effect immediately, arguably even with keyboard navigation. onBlur only would require another action to remove focus from the select (tabbing or clicking outside the field), which is unexpected when submit button is omitted.

We should decide whether this is an acceptable disabling of the rule, whether refactoring should be made to accommodate the rule, or whether we should remove the rule altogether.

@aduth aduth added [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Type] Question Questions about the design or development of the editor. labels Apr 10, 2017
@afercia
Copy link
Contributor

afercia commented Apr 20, 2017

If the mode switcher is going to be implemented with a native HTML select element, then the onChange event is problematic since browsers behave differently. Also operating systems come into play. On Windows, focusing a select element with the keyboard and using the arrow keys doesn't open the select.

So on Windows, the only way to explore the options in a select is using the arrow keys and if that triggers the mode switching, it would be completely unexpected.

About browsers inconsistencies, historically Firefox has been for years the only browser to correctly implement the specification that states the change event should fire when a select option has been selected AND focus is moved away from the select. Instead, Chrome and IE trigger the event as soon as an option has been selected. That's wrong, according to the spec.

However, browsers have bug 😬 see https://bugzilla.mozilla.org/show_bug.cgi?id=1350700

@jasmussen
Copy link
Contributor

jasmussen commented Apr 20, 2017

What if it was a toggle button?

[Visual ▼]

click

[Text ▼]

click

[Visual ▼]

?

@aduth
Copy link
Member Author

aduth commented Apr 20, 2017

What about a button group or tabs similar to what exists currently?

Button Group

Tabs

To me, these seem clearest for managing a toggle between two states (select for many options, toggle button very opaque). But the equal weight between modes assumes that switching to Text is a common workflow.

@jasmussen
Copy link
Contributor

jasmussen commented Apr 20, 2017

What about a button group or tabs similar to what exists currently?

I like that a lot.

Edit: though I want to clarify that the reason I designed it as a dropdown initially, was in a vague hope that one day a plugin might register itself as another editing option there. Imagine picking "Markdown" in the dropdown, then toggling the splitscreen preview, and you essentially have Ulysses.

@afercia
Copy link
Contributor

afercia commented Apr 20, 2017

A button group would be perfectly OK for a11y, using an aria-pressed attribute set to true for the active mode and false for the inactive one. This would make them being announced as selected Toggle button and Toggle button, indicating that only one can be active at a time.

in a vague hope that one day a plugin might register itself as another editing option

wouldn't be possible to allow plugins to add buttons for their custom mode?

@jasmussen
Copy link
Contributor

wouldn't be possible to allow plugins to add buttons for their custom mode?

Yes, but it's not a very scalable UI, it takes up a lot of space. And visually the more we can reduce, the lower the cognitive weight. It would also more easily translate to mobile.

@afercia
Copy link
Contributor

afercia commented Apr 20, 2017

Yeah.. than maybe a custom dropdown would help normalizing the various browsers inconsistencies, but it should be veeery carefully implemented.

@jasmussen
Copy link
Contributor

Here's a mockup of the tabgroup version using icons:

screen shot 2017-04-28 at 11 37 33

@joyously
Copy link

I really can't tell what those icons mean. PLEASE don't get rid of the text labels!

@afercia
Copy link
Contributor

afercia commented Apr 28, 2017

@joyously I'd agree text labels are necessary. Same for the other controls in the toolbar that are being discussed on #467 and (partly) on #503. I'd greatly appreciate some feedback there from you and other designers :)

@melchoyce
Copy link
Contributor

Icons sans labels tend to be "mystery meat" navigation — I agree that here especially, we'll want to include labels or consider an alternate design that's text-first.

@jasmussen
Copy link
Contributor

👍 I agree in this case. But it's always, always a balance. Bold, for example, doesn't need a label ;)

@melchoyce
Copy link
Contributor

Agreed — I think the majority of the editor icons don't need labels because they're so ubiquitous. But a couple of them still stump me, even with context.

@afercia
Copy link
Contributor

afercia commented Jul 18, 2017

Re: onChange, see also https://core.trac.wordpress.org/ticket/31634 and https://core.trac.wordpress.org/ticket/40925 where I've posted a video to illustrate what onchange does on select elements on Windows:
https://cloudup.com/iuFxQ7CkA7k

@aduth
Copy link
Member Author

aduth commented Sep 6, 2017

It's unclear whether there's an actionable direction here for the tab group design. Labeling as such.

@aduth aduth added the Needs Design Needs design efforts. label Sep 6, 2017
@afercia
Copy link
Contributor

afercia commented Nov 6, 2017

The mode switcher is not a select any longer. It is now behind the "More" button, and technically it's a button. I think this specific issue can be closed, although the new drop down menu would benefit from some accessibility improvements, e.g. arrow navigation, constraining tabbing, proper labeling. These points should be addressed in a separate issue, as there has been some progress with specific components for drop down menus.

screen shot 2017-11-06 at 16 24 08

screen shot 2017-11-06 at 16 24 25

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). Needs Design Needs design efforts. [Type] Question Questions about the design or development of the editor.
Projects
None yet
Development

No branches or pull requests

5 participants