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

Fix PostPublishButton toggle #13194

Merged
merged 1 commit into from
Jan 9, 2019
Merged

Fix PostPublishButton toggle #13194

merged 1 commit into from
Jan 9, 2019

Conversation

oandregal
Copy link
Member

Fixes #13014
Complements #12885

Test

  • open a bare new post
  • make sure the pre-publish checks are enabled
  • click the "publish..." button.

The current behavior is that the publish sidebar will be opened, but it shouldn't be.

@oandregal oandregal requested review from aduth and youknowriad January 4, 2019 17:46
@oandregal oandregal self-assigned this Jan 4, 2019
@oandregal oandregal added the [Type] Bug An existing feature does not function as intended label Jan 4, 2019
@oandregal
Copy link
Member Author

Not sure what milestone should I use for this bugfix.

@aduth
Copy link
Member

aduth commented Jan 4, 2019

With the changes here, the button would still be focusable by tabbing, which would be unexpected for a disabled element.

@youknowriad
Copy link
Contributor

I think a similar fix landed? The fact that the button stays tabbable when it's "disabled" property changes is expected to avoid focus loss. All the buttons in the toolbar behaves this way IIRC.

@aduth
Copy link
Member

aduth commented Jan 7, 2019

The fact that the button stays tabbable when it's "disabled" property changes is expected to avoid focus loss.

Which focus loss? A disabled button is not meant to be tabbable, so I don't find the behavior to be expected. If it's specifically about the focus return behavior for the publish panel, then (a) isn't the button not being disabled a prerequisite for the panel to have been opened in the first place, and (b) it's an implementation detail which shouldn't impact the expected interaction of disabled/enabled button tabbing order.

@youknowriad
Copy link
Contributor

It's about the button becoming disabled when it's currently focused. Say, you're current on the publish button and for some reason (ajax call or something), the post is not saveable anymore, if we disable the button, the focus will be lost and moved to the body forcing people to tab all over again.

That's how I understood it at least. cc @afercia

@afercia
Copy link
Contributor

afercia commented Jan 7, 2019

Correct.

Note that modern browsers try to keep focus "in place". That's what, for example, Chrome has implemented in version 50 and called https://bugs.chromium.org/p/chromium/issues/detail?id=454172.

However, don't let that fool you: focus is actually lost, as the previously focused element just became unfocusable. Also, there's no guarantee browsers are still able to keep focus in the sequential order when a screen reader or other assistive technology is used. I've seen that failing often.

Besides technical details, the ARIA Authoring Practices allow for focusability of disabled controls in some cases, see https://www.w3.org/TR/wai-aria-practices-1.1/#kbd_disabled_controls. Seems to me the most important recommendation they do is to adopt a consistent set of conventions.

@aduth
Copy link
Member

aduth commented Jan 7, 2019

Besides technical details, the ARIA Authoring Practices allow for focusability of disabled controls in some cases, see https://www.w3.org/TR/wai-aria-practices-1.1/#kbd_disabled_controls. Seems to me the most important recommendation they do is to adopt a consistent set of conventions.

Interesting, thanks for sharing. It's a bit unclear to me from the text whether tabbability and focusability are meant to be interchangeable, especially considering their example is one which uses arrow keys to navigate disabled items. As far as it impacts discoverability, I guess I'd agree that having these disabled elements be focusable would be a benefit. I think consistency will be the challenge though, since it requires more conscious consideration in deciding whether a disabled element qualifies to be focusable.

@afercia
Copy link
Contributor

afercia commented Jan 7, 2019

Yep, consider the ARIA Authoring Practices refer mainly to ARIA widgets (toolbars, and so on) but the general principle of keeping "disabled" element focusable is applicable in other cases too, when it's a benefit.

it requires more conscious consideration in deciding whether a disabled element qualifies to be focusable.

Absolutely. It should be evaluated on a case by case basis.

Because we're using aria-disabled instead of the disabled property
the button is clickable. We need to back off from firing the onToggle
event if the toggle is disabled.
@oandregal oandregal added this to the 5.0 (Gutenberg) milestone Jan 8, 2019
@oandregal
Copy link
Member Author

I saw there was some reorganization since I created this PR, and e2e test were failing. Rebased from master and everything is good now.

@youknowriad youknowriad modified the milestones: 5.0 (Gutenberg), 4.9 Jan 8, 2019
@youknowriad youknowriad merged commit b62e0f5 into master Jan 9, 2019
@youknowriad youknowriad deleted the fix/publish-button branch January 9, 2019 09:09
youknowriad pushed a commit that referenced this pull request Mar 6, 2019
Because we're using aria-disabled instead of the disabled property
the button is clickable. We need to back off from firing the onToggle
event if the toggle is disabled.
youknowriad pushed a commit that referenced this pull request Mar 6, 2019
Because we're using aria-disabled instead of the disabled property
the button is clickable. We need to back off from firing the onToggle
event if the toggle is disabled.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants