fix(#3735): fix tooltip position in Work Side Menu and add to toggle button#3786
fix(#3735): fix tooltip position in Work Side Menu and add to toggle button#3786
Conversation
979008d to
d4d239d
Compare
| // Menu-scoped keyboard navigation (only fires when focus is inside menu) | ||
| function handleMenuKeyDown(e: KeyboardEvent) { | ||
| switch (e?.key) { | ||
| case "ArrowDown": |
There was a problem hiding this comment.
I forgot to remove this from a previous PR. It was causing errors so I removed it here.
| }, 300); | ||
| } | ||
|
|
||
| function showToggleTooltip() { |
There was a problem hiding this comment.
We should rename this handleToggleHover() instead of showToggleTooltip() as it may cause the confusion between showTooltip and showToggleTooltip.
Also we can shorten like this:
function handleToggleHover() {
if (open) return;
setTooltipPos("Expand menu", _toggleButtonEl);
showTooltip();
}
so under button below we can do like this:
<button ...
on:mouseenter={handleToggleHover}
on:mouseleave={hideTooltip}
on:focus={handleToggleHover}
on:blur={hideTooltip}
| position: relative; | ||
| z-index: 101; | ||
| height: 100vh; | ||
| height: var(--goa-work-side-menu-height, 100vh); |
| <button | ||
| className="search-menu-button" | ||
| onClick={openSearch} | ||
| onMouseEnter={showSearchTooltip} |
There was a problem hiding this comment.
Question: was the reason for using a custom <button> here (instead of wrapping WorkSideMenuItem with a sentinel URL like /search) specifically to display the ⌘K keyboard shortcut as trailing content?
I asked because the doc site already has an established pattern for non-navigation items using WorkSideMenuItem + URL + wrapper onClick
For example: ComponentsSubMenu
If the ⌘K is the only blocker, we could drop it and use the badge like now instead, then we can add a story to follow up for trailingSlot on the WorkSideMenuItem.
If we can use WorkSideMenuItem instead of button here then we can have tooltip feature without having to add a customized function here.
cc @twjeffery How do you think?


This PR adds the following fixes to the Work Side Menu: