Page MenuHomePhabricator

MenuItem: refine highlight behavior
Closed, ResolvedPublic

Description

As part of T327499, we discussed two potential improvements of the highlight behavior of the MenuItem component:

  1. Do not highlight a menu item if the cursor is below the menu when it opens and happens to be on top of a MenuItem. Instead, wait until the user intentionally moves the cursor.
  2. Do not allow double highlighting: currently, you can highlight a MenuItem via the mouse, then use the arrow keys to highlight a second MenuItem. Instead, only a single MenuItem should be highlighted at a time, and it should be the one that the user last interacted with.

This task covers implementing these improvements.


Acceptance criteria

  • MenuItem is no longer highlighted on menu expansion when the cursor happens to be on top of that MenuItem
  • Only one MenuItem is ever highlighted at a time, and that item is the one the user last interacted with (either via the mouse or the keyboard)

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Restricted Application triaged this task as High priority. · View Herald TranscriptFeb 27 2023, 3:20 PM

Change 888799 had a related patch set uploaded (by Anne Tomasevich; author: Anne Tomasevich):

[design/codex@main] MenuItem: Change highlight behavior

https://gerrit.wikimedia.org/r/888799

@alexhollender_WMF @Sarai-WMDE we could use your feedback on this change, if you have a moment!

If you visit the TypeaheadSearch demo based on my open patch, you can see the following changes:

No more double-highlighting

Steps to reproduce:

  1. In the Wikipedia demo, type in a search term
  2. Use your mouse to hover over a menu item.
  3. Then, use an arrow key to move the highlight to a different item.

You will notice that the item you highlighted with your mouse is no longer highlighted, and the item that you navigated to with the arrow key is. Previously, both items would have been highlighted.

You can also test the inverse:

  1. Repeat steps 1-3 above
  2. Then move your mouse over the same menu item you originally hovered over

You'll see that the item you're hovering over becomes highlighted again.

No highlight on unintentional hover

Steps to reproduce:

  1. In the Wikipedia demo, click into the input
  2. Move your mouse below the input (where the menu will eventually open)
  3. Type in a search term so that the menu opens

You'll see that the menu item under your cursor is not immediately highlighted. If you move your mouse, the menu item under it will become highlighted at that time. Previously, the item under your mouse when the menu was opened would be highlighted, even though you didn't really indicate that you meant to hover over it.


Please let me know if you approve of this new behavior, disagree with it, or have any other comments about highlighting behavior! cc @bmartinezcalvo @Volker_E

@AnneT both new behaviors make sense to me and I've checked the patch and they work well.

Change 888799 merged by jenkins-bot:

[design/codex@main] MenuItem: Change highlight behavior

https://gerrit.wikimedia.org/r/888799

@alexhollender_WMF @Sarai-WMDE we could use your feedback on this change, if you have a moment!
...
Please let me know if you approve of this new behavior, disagree with it, or have any other comments about highlighting behavior! cc @bmartinezcalvo @Volker_E

looks great to me

Checked highlight behavior on Chrome, Safari and Mozilla. It LGTM.

Change 898895 had a related patch set uploaded (by Eric Gardner; author: Eric Gardner):

[mediawiki/core@master] Update Codex from v0.6.2 to v0.7.0

https://gerrit.wikimedia.org/r/898895

ldelench_wmf claimed this task.