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

Redesign on state in menu and dropdowns #16573

Merged
merged 31 commits into from
Jun 28, 2024
Merged

Redesign on state in menu and dropdowns #16573

merged 31 commits into from
Jun 28, 2024

Conversation

Mati365
Copy link
Member

@Mati365 Mati365 commented Jun 14, 2024

Suggested merge commit message (convention)

Fix (ui): Improve accessibility of menu bar toggle items by marking them as menucheckbox aria roles.
Feature (ui): Redesign of menu items styling.

Closes #16572.

Additional information

Commercial PR: https://github.com/cksource/ckeditor5-commercial/pull/6339

Before

obraz
obraz

After

obraz
obraz

@Mati365 Mati365 marked this pull request as draft June 14, 2024 10:38
@Mati365 Mati365 force-pushed the ck/16572 branch 2 times, most recently from 425986c to 14ceb90 Compare June 19, 2024 06:53
@Mati365 Mati365 marked this pull request as ready for review June 19, 2024 06:53
@Mati365 Mati365 marked this pull request as draft June 19, 2024 07:13
@Mati365 Mati365 self-assigned this Jun 20, 2024
@Mati365 Mati365 marked this pull request as ready for review June 20, 2024 09:01
@scofalik
Copy link
Contributor

scofalik commented Jun 24, 2024

Below are conclusions from manual testing I did (some relate to commercial features PR):

  1. Following menu items are not getting "on" state: Link, Block quote, Comments archive, Accessibility dialog, Find and replace. Additionally, AI Assistant gets incorrect styling (it is all grayed, instead of getting a checkbox). Finally, Comments archive doesn't get "on" state in toolbar either -- it's not directly related to this ticket but we could fix it as it's the same part of the code.
  2. Switch toggle menu items have incorrect styling. When they are on, they are blue. See track changes toolbar dropdown.
  3. Focus do not follow mouse hovering on the top-level menu items ("Insert", "View", etc.) IF the keyboard interaction was when the menu was not open. To test this focus menu using Alt+F9, then click right arrow, then hover other items.
  4. In revision history, in sidebar, for a selected revision (blue), if open the revision menu (click tripe-dot) the items inside have white font color.
  5. Format -> Highlight -> options, when one of them is selected it "loses its colors".

Some other thoughts that are not directly related to this PR and can be done as a follow-up:

  1. In toolbar dropdowns, focus is not following the mouse hovers. I guess this one can be solved together / after "new dropdowns" PR.
  2. The mockups for the "checked menu items" has not only changes related to colors and checkboxes but also to paddings AFAIR. We should also introduce these changes at some point, but we can do it separately.
  3. "None" option in border dropdown in table properties and table cell properties components is not "on" when it is chosen. This is not a regression.
  4. Since you can now close a tooltip using ESC, you need double ESC to close Format -> Bulleted List -> dropdown. If you wait a while, the first ESC will close the tooltip (e.g. "Circle" tooltip), then only the second ESC will close the dropdown. I found it counterintuitive and unexpected (cc @oleq).
  5. Icons in lists dropdowns do not get focus when hovered with mouse (cc @oleq).

@Mati365
Copy link
Member Author

Mati365 commented Jun 24, 2024

@scofalik Thx! Will be fixed.

@scofalik
Copy link
Contributor

One more thing @Comandeer @oleq.

When I click the top-level menu item (like "Insert") it gets focus and the focus will follow the mouse hover. I wonder about this behavior. On one hand, it seems correct to show the focus when I clicked the top-level menu item. On the other hand, it is weird that the focus follows the mouse. But it would be also weird if it didn't. So I wonder if we have to show the focus on click and if we can hide it when hovering other items. It is also inconsistent with hovering items inside such menu. E.g. if I hover&click "Insert" it shows the focus but then I hover down and the focus is not shown anymore. But if I hover left&right, the focus is kept. See video.

Screen.Recording.2024-06-24.at.16.19.27.mov

Copy link
Contributor

@scofalik scofalik left a comment

Choose a reason for hiding this comment

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

Other than what I commented, please try to use properties and methods name as short as possible. Maybe you'll find some room for improvement. I also dislike maybeXXX approach. I get your point, but that's not really necessary if we have typed code and if the method is very short or you immediately early return like this:

const listView = pickListView();

if ( !listView ) {
    return;
}

packages/ckeditor5-basic-styles/src/bold/boldui.ts Outdated Show resolved Hide resolved
packages/ckeditor5-ui/src/button/filedialogbuttonview.ts Outdated Show resolved Hide resolved
packages/ckeditor5-ui/src/button/filedialogbuttonview.ts Outdated Show resolved Hide resolved
packages/ckeditor5-ui/src/dropdown/utils.ts Show resolved Hide resolved
packages/ckeditor5-ui/src/menubar/menubarview.ts Outdated Show resolved Hide resolved
packages/ckeditor5-ui/src/menubar/utils.ts Outdated Show resolved Hide resolved
packages/ckeditor5-ui/src/menubar/utils.ts Show resolved Hide resolved
packages/ckeditor5-ui/src/menubar/menubarmenulistview.ts Outdated Show resolved Hide resolved
@scofalik

This comment was marked as resolved.

@Mati365
Copy link
Member Author

Mati365 commented Jun 25, 2024

@scofalik

Other than what I commented, please try to use properties and methods name as short as possible. Maybe you'll find some room for improvement.

I tend to use the most descriptive names as I can, even if they are longer, so we can read them as a recipe step that shortly describes what the method does without looking at docs or types. Although it's my personal opinion, I'm perfectly fine with renaming. Can you point me which methods and variables should be renamed (and what is a preferable way to name them?). It'd helpful and save my time.

I also dislike maybeXXX approach. I get your point, but that's not really necessary if we have typed code and if the method is very short or you immediately early return like this:

Sorry, I forgot about our discussions about these maybe prefixes, and I renamed these maybeXXX variables. I used to do them while using optional monodic result of functions to quickly determine without looking at the type if type might be nullable.

@Mati365 Mati365 requested a review from scofalik June 25, 2024 12:05
@Comandeer
Copy link
Member

Replying to #16573 (comment):

"Focus visible" SC requires focus only during keyboard operations. I would argue that it allows us to skip showing the focus indicator if the user hovers over a top-level menu item with a mouse. Skipping the indicator there would make the whole experience consistent.

So:

  1. If the user operates a top-level menu item with a mouse, do not add focus indicator.
  2. As soon as the user starts using keyboard, show the focus indicator.

@scofalik
Copy link
Contributor

Sorry, I forgot about our discussions about these maybe prefixes, and I renamed these maybeXXX variables. I used to do them while using optional monodic result of functions to quickly determine without looking at the type if type might be nullable.

👍

I tend to use the most descriptive names as I can, even if they are longer, so we can read them as a recipe step that shortly describes what the method does without looking at docs or types.

Of course, this is a good rule to follow. But sometimes these names get a bit too long and reading them line after line is tiring. Sometimes they do not fit convention. Some things I'd think about from this PR are:

  • Does it have to be CheckHolder or maybe Check is enough?
  • _shouldRenderCheckHolder -> _hasCheck
  • hasReservedCheckHolderSpace -> hasCheckSpace or requiresCheckSpace or addCheckSpace

Do you have to change these names? Honestly, these ones are deep and used slightly, so it isn't a critical thing. But I think you have slight tendency to overdescribe the names, so you can treat it as a general advice.

@Mati365
Copy link
Member Author

Mati365 commented Jun 25, 2024

@scofalik Replaced 👍🏻

@scofalik
Copy link
Contributor

scofalik commented Jun 25, 2024

One more example: _preallocateCheckSpacerInItemsIfNeeded. I am not a big fan of this name too 😄. First, of course we do this only if needed, we don't do stuff if it is not needed. If you feel it is important to explain what exactly happens, we can add proper comment in API doc. I'd probably go with something like _setItemsCheckSpace.

Copy link
Contributor

@scofalik scofalik left a comment

Choose a reason for hiding this comment

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

Almost there. One bug left.

packages/ckeditor5-basic-styles/src/utils.ts Outdated Show resolved Hide resolved
packages/ckeditor5-ui/src/button/listitembuttonview.ts Outdated Show resolved Hide resolved
packages/ckeditor5-ui/src/menubar/utils.ts Show resolved Hide resolved
@oleq
Copy link
Member

oleq commented Jun 26, 2024

  • Since you can now close a tooltip using ESC, you need double ESC to close Format -> Bulleted List -> dropdown. If you wait a while, the first ESC will close the tooltip (e.g. "Circle" tooltip), then only the second ESC will close the dropdown. I found it counterintuitive and unexpected (cc @oleq).

Since this is the only place that acts this way, I wouldn't be worried. There are pros and cons of this approach.

5. Icons in lists dropdowns do not get focus when hovered with mouse (cc @oleq).

AFAIR they are custom-made and don't share the same logic that makes up the menu bar. I don't know how to address this issue yet, though. Also, I suppose the same goes with in-toolbar dropdowns in general because they are different UI components and they are missing this mouse-to-keyboard logic.

@Mati365
Copy link
Member Author

Mati365 commented Jun 26, 2024

Since you can now close a tooltip using ESC, you need double ESC to close Format -> Bulleted List -> dropdown. If you wait a while, the first ESC will close the tooltip (e.g. "Circle" tooltip), then only the second ESC will close the dropdown. I found it counterintuitive and unexpected

@scofalik imo, it's correct behavior. There could be situations where you focus an item using keyboard, like in multi-level lists, then tooltip shows and it overlaps another items. To get of rid of them, without closing dropdown, ESC should be used.

AFAIR they are custom-made and don't share the same logic that makes up the menu bar. I don't know how to address this issue yet, though. Also, I suppose the same goes with in-toolbar dropdowns in general because they are different UI components and they are missing this mouse-to-keyboard logic.

@oleq I created a separated issue about that: #16612

@Mati365 Mati365 requested a review from scofalik June 26, 2024 11:30
@scofalik
Copy link
Contributor

Regarding tooltips: sometimes it is correct, sometimes not. I understand why we introduced closing tooltips on ESC and I don't discuss it - I agree that was an improvement. But in this case it was a UX degradation from my point of view and how I used it, I noticed it and wrote about it. There's probably no way to have both, so I am fine with how it is.

It wouldn't be a problem if the list components were better integrated with the menu bar, i.e., if I was able to leave the list types grid by pressing arrow left or arrow up when in left column / top row.

@scofalik scofalik merged commit ac3d173 into master Jun 28, 2024
6 checks passed
@scofalik scofalik deleted the ck/16572 branch June 28, 2024 12:10
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.

Redesign on state in menu and dropdowns
4 participants