Skip to content

fix: mouse/keyboard interactions of menu/menu-item (DELETE)#2658

Closed
martascorreia wants to merge 7 commits intonextfrom
fix/mouse-click-hinders-keyboard
Closed

fix: mouse/keyboard interactions of menu/menu-item (DELETE)#2658
martascorreia wants to merge 7 commits intonextfrom
fix/mouse-click-hinders-keyboard

Conversation

@martascorreia
Copy link
Copy Markdown
Contributor

@martascorreia martascorreia commented Dec 12, 2025

Description:

Closes #2372. The problem is related to activation of focus-visible.

When we click the dropdown menu with the mouse, the focus is put on the menu-item correctly with "focus", however, the focus-visible that puts the border around the item is not activated. This property only activates after a keyboard event. So for example in Safari, if you do "arrowdown" and then click "arrowright" (or any other key we are not catching), the outline suddenly appears because an event key was propagated.

My solution was to force this css to appear, and also remove it when not needed. Please let me know if you know a better way to handle this.

Definition of Reviewable:

  • Stories (features, a11y) are created/updated
  • relevant tickets are linked

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Dec 12, 2025

🦋 Changeset detected

Latest commit: 7206cad

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

💥 An error occurred when fetching the changed packages and changesets in this PR
Some errors occurred when validating the changesets config:
The package or glob expression "@solid-design-system/components" specified in the `fixed` option does not match any package in the project. You may have misspelled the package name or provided an invalid glob expression. Note that glob expressions must be defined according to https://www.npmjs.com/package/micromatch.
The package or glob expression "@solid-design-system/styles" specified in the `fixed` option does not match any package in the project. You may have misspelled the package name or provided an invalid glob expression. Note that glob expressions must be defined according to https://www.npmjs.com/package/micromatch.
The package or glob expression "@solid-design-system/tokens" specified in the `fixed` option does not match any package in the project. You may have misspelled the package name or provided an invalid glob expression. Note that glob expressions must be defined according to https://www.npmjs.com/package/micromatch.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Dec 12, 2025

🚀 Storybook has been deployed for branch fix_mouse-click-hinders-keyboard

Comment thread .changeset/tough-flies-think.md Outdated
if (menu) {
const current = menu.getCurrentItem();
current?.classList.remove('force-visible-focus');
console.log(current);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please remove log

@apply focus-outline outline-offset-[-2px];
}

:host(.force-visible-focus) [part='base'] {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I would prefer not to use the word force. Either remove it or call it something like menu-item-focus.

@smfonseca smfonseca removed their assignment Jan 12, 2026
Co-authored-by: Sérgio Fonseca <42741644+smfonseca@users.noreply.github.com>
@mariohamann
Copy link
Copy Markdown
Contributor

Please add tests for this, as this fairly hard to reproduce without knowing what the issue was.

Copy link
Copy Markdown
Contributor

@mariohamann mariohamann left a comment

Choose a reason for hiding this comment

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

Add tests.

@mariohamann mariohamann changed the title fix: mouse click hinders keyboard fix: 🐛 fix mouse/keyboard interactions of menu/menu-item Jan 15, 2026
@martascorreia martascorreia moved this from 👀 In review to 🏗 In progress in Solid Design System Project Board Jan 15, 2026
@martascorreia martascorreia changed the title fix: 🐛 fix mouse/keyboard interactions of menu/menu-item fix: 🐛 fix mouse/keyboard interactions of menu/menu-item (DELETE) Jan 20, 2026
@martascorreia martascorreia changed the title fix: 🐛 fix mouse/keyboard interactions of menu/menu-item (DELETE) fix: mouse/keyboard interactions of menu/menu-item (DELETE) Jan 20, 2026
@github-project-automation github-project-automation Bot moved this from 🏗 In progress to ✅ Done in Solid Design System Project Board Jan 20, 2026
martascorreia added a commit that referenced this pull request Jan 30, 2026
## Description:
Closes #2372. 
Previously this PR:
#2658

The problem is related to activation of focus-visible. 

When we click the dropdown menu with the mouse, the focus is put on the
menu-item correctly with "focus", however, the focus-visible that puts
the border around the item is not activated. This property only
activates after a keyboard event. So for example in Safari, if you do
"arrowdown" and then click "arrowright" (or any other key we are not
catching), the outline suddenly appears because an event key was
propagated.

My solution was to force this css to appear, and also remove it when not
needed. Please let me know if you know a better way to handle this.

## Definition of Reviewable:
- [x] Stories (features, a11y) are created/updated
- [X] relevant tickets are linked
@martascorreia martascorreia deleted the fix/mouse-click-hinders-keyboard branch February 10, 2026 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

fix: 🤔 sd-menu – mouse click hinders keyboard behaviour

6 participants