Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

md-autofocus does not work on md-menu-item > md-button #7868

Closed
isaaclyman opened this issue Apr 4, 2016 · 2 comments
Closed

md-autofocus does not work on md-menu-item > md-button #7868

isaaclyman opened this issue Apr 4, 2016 · 2 comments
Assignees
Labels
has: Pull Request A PR has been created to address this issue

Comments

@isaaclyman
Copy link
Contributor

When using md-autofocus with an optional expression (e.g. md-autofocus="ctrl.a === ctrl.b") on an md-button that is the direct child of an md-menu-item, the _md-autofocus class is applied to the compiled <button> element, but when the menu opens, focus is given to the first item in the list anyway. It appears that the md-autofocus attribute is completely disregarded in this case.

Applying the md-autofocus to the md-menu-item element itself does not work either. If it is intended behavior that md-autofocus does not work for elements in an md-menu, this should be documented (and I'd like to know the reason why).

@ThomasBurleson ThomasBurleson modified the milestone: Backlog Apr 20, 2016
@devversion
Copy link
Member

devversion commented Apr 24, 2016

The problem is, that md-autofocus is not the correct attribute for the menu component.

  • It's md-menu-focus-target

In my opinion, we should also support md-autofocus here.

http://codepen.io/DevVersion/pen/BKPEBy

I will mark this, as blocked by PR, because I would like to add the support for md-autofocus after #8163 is merged.

@devversion devversion added the Blocked Progress on this issue is blocked. Primarily used for PRs that are blocked by presubmit feedback. label Apr 24, 2016
@ThomasBurleson
Copy link
Contributor

@devversion - Agreed. Please add support.

@devversion devversion added has: Pull Request A PR has been created to address this issue and removed Blocked Progress on this issue is blocked. Primarily used for PRs that are blocked by presubmit feedback. labels May 16, 2016
devversion added a commit to devversion/material that referenced this issue May 16, 2016
* Currently, the most common components are supporting `md-autofocus`, except the `$mdMenu` component.
  `md-menu` did only support `md-menu-focus-target`, which was a unclear and undocumented attribute.

* This commit adds support for the `md-autofocus` directive, to be consistent with the whole API.
   It also adds a documentation for the focus behavior in `md-menu`.

Closes angular#7868.
@Splaktar Splaktar removed this from the - Backlog milestone Feb 23, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
has: Pull Request A PR has been created to address this issue
Projects
None yet
Development

No branches or pull requests

4 participants