Skip to content

bug(cdkContextMenu): First item focus:visible and gets ring design #31569

@ShaharKrichli

Description

@ShaharKrichli

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

Im building a context menu using spartan/ui which uses cdk context menu.
On first open through a right click first item gets focus (which he should), but he also receive focus:visible ring design.
after a click on some menu item, or on a selectable item in the screen, this behavior is gone.

This behavior exist in angular context menu example, regardless of spartan or my implementation

Reproduction

StackBlitz link: https://stackblitz.com/run?file=src%2Fexample%2Fcdk-menu-nested-context-example.ts
Steps to reproduce:

  1. Right click on the context menu
  2. ring design is applied
  3. click on any of the items
  4. open context menu again using right click
  5. ring design isnt there, but item is still focused

Expected Behavior

on first open of the context menu, first item will be focused but not focus:visible so ring design wont be shown

Actual Behavior

on first open of the context menu, first item is focus:visible so gets shown the ring design of focus:visible

Environment

  • Angular: 20.1
  • CDK/Material: 20.1
  • Browser(s): chrome
  • Operating System - Macos

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs triageThis issue needs to be triaged by the team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions