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 incorrect value of [aria-expanded] on menubuttons #5255

Merged
merged 6 commits into from
Jul 11, 2022
Merged

Conversation

Comandeer
Copy link
Member

What is the purpose of this pull request?

Bug fix

Does your PR contain necessary tests?

All patches that change the editor code must include tests. You can always read more
on PR testing,
how to set the testing environment and
how to create tests
in the official CKEditor documentation.

This PR contains

  • Unit tests
  • Manual tests

Did you follow the CKEditor 4 code style guide?

Your code should follow the guidelines from the CKEditor 4 code style guide which helps keep the entire codebase consistent.

  • PR is consistent with the code style guide

What is the proposed changelog entry for this pull request?

* [#5144](/~https://github.com/ckeditor/ckeditor4/issues/5144): Fixed: [menu buttons](https://ckeditor.com/cke4/addon/menubutton) and [panel buttons](https://ckeditor.com/cke4/addon/panelbutton) incorrectly indicates the open status of their associated pop-up menus.

What changes did you make?

As explained in #5144 (comment) I had to find another way to detect if the menu is open. Fortunately, this information is available as an internal property of the button, button._.on.

I was thinking about exposing this property as a public one but finally decided not to do that. This decision really simplified the solution but at the same time – made it a little bit dirty (as the internal property is now used directly inside the button plugin)

Which issues does your PR resolve?

Closes #5144.

@sculpt0r sculpt0r self-assigned this Jul 7, 2022
@sculpt0r sculpt0r self-requested a review July 7, 2022 05:43
@sculpt0r
Copy link
Contributor

sculpt0r commented Jul 8, 2022

Rebased on the newest master.

Copy link
Contributor

@sculpt0r sculpt0r left a comment

Choose a reason for hiding this comment

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

@Comandeer I left one significant inline comment. There are two ways to choose there (or you can see even more?). I believe you can choose the right one based on your a11y knowledge. However, if I'm incorrect at some point - please let me know :p So we can establish the approach together 👍

plugins/button/plugin.js Outdated Show resolved Hide resolved
@Comandeer
Copy link
Member Author

I've completely rewritten the solution. I've moved the logic responsible for setting the [aria-expanded] attribute to the menubutton and panelbutton plugins. The only bit left inside the button plugin is adding the initial value of the [aria-expanded] attribute if the button.hasArrow property is set.

@Comandeer Comandeer requested a review from sculpt0r July 9, 2022 22:46
@jacekbogdanski jacekbogdanski requested review from jacekbogdanski and removed request for sculpt0r July 11, 2022 10:08
@jacekbogdanski jacekbogdanski self-assigned this Jul 11, 2022
Copy link
Member

@jacekbogdanski jacekbogdanski left a comment

Choose a reason for hiding this comment

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

Good job!

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.

Incorrect aria-expanded on language button after language selection
3 participants