Skip to content

Focus is lost when menu is closed #8290

@huygaa11

Description

@huygaa11

Bug, feature request, or proposal:

Menu should return focus to the host element when closed.

What is the expected behavior?

When a menu is closed, focus should go back to the host element that called the menu.

What is the current behavior?

The focus is being lost and sent to body element.

What are the steps to reproduce?

  1. Open the first menu in https://material.angular.io/components/menu/overview
  2. Close it by pressing ESC or choosing one of the options.
  3. check document.activeElement using the developer console. Or, press TAB to see that the focus is set on the first element of the DOM.

What is the use-case or motivation for changing an existing behavior?

Losing focus in a middle of a workflow is really bad for a11y.

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

My set up: Angular 2, Material 2, TS, Mac, Chrome

Is there anything else we should know?

buganizer: b/64452100

Metadata

Metadata

Assignees

Labels

AccessibilityThis issue is related to accessibility (a11y)P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions