-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MdMenu : keep menu open on item click #2612
Comments
I would like to utilize this feature to allow menu to take text inputs. Perhaps a new directive:
We could throw this on the |
I just found this in the ReadMe: `Not yet implemented
Which isn't quite what we are looking for, but it's close and a good indication that similar features are being considered. From what I've read of the source we just need to prevent click events on |
@Robouste Here's an ugly workaround. I'll turn it into a directive soon and update. For some reason using this with |
@nayfin Thank you, it seems to do the trick. But I choose the bootstrap dropdown, more customizable (for now !) |
I have an input in my menu and this worked find |
Being able to turn this off would be great. We implemented a menu very similar to the google inbox account menu and ran into this issue. We had to add a click handler and stopPropagation on the entire menu. |
Chatted w/ @kara about this and we decided that we don't want to add this as a feature to md-menu. This is largely because turning it on would be detrimental to the a11y experience (see https://www.w3.org/TR/wai-aria-practices-1.1/#menu), and we want to generally avoid adding APIs that go counter to a11y best practices. |
For those who are waiting for this to be merged, this is how i did it to implement a multi-select columns in a table (i didnt want the input part of select). I basically removed the md-menu-item directive and used the class mat-menu-item for the styling.
Hope this helps. |
@jelbourn @kara Clearly shows when clicking on the menu it doesn't close. |
import {Directive, HostListener} from '@angular/core';
@Directive({
selector: '[click-stop-propagation]'
})
export class ClickStopPropagation {
@HostListener('click', ['$event'])
public onClick(event: any): void {
event.stopPropagation();
}
} <div click-stop-propagation>Stop Propagation</div> |
And the irony is, blocking it from being used is detrimental to everyone's experience. Devs, and users included. I don't even know why this a11y thing is taking precedence over common sense, and established UI standards. The only reason I'm even posting in this issue is that the angular material library has failed to provide some sort of popover component that animates from the button that was clicked, or instead opens as a full-screen overlay on narrow screens. Such a fundamental component that's been around on mobile and web forever (easily achievable on the Android and iOS SDK), which would utilise your existing components in a pretty simple way. I used to have md-panel at least: https://material.angularjs.org/1.1.1/api/type/MdPanelPosition But currently, I have to either twist a mat-menu to meet my needs, to use a dialog which also gives me no control over where it animates from. And what I'm making is totally fine from an accessibility standpoint... |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Bug, feature request, or proposal:
feature request
What is the expected behavior?
It would be great to have an option to keep the menu open when we click a menu item
What is the current behavior?
On item menu click, the menu closes
What are the steps to reproduce?
Plunkr
What is the use-case or motivation for changing an existing behavior?
Putting checkboxes in the menu for example
Which versions of Angular, Material, OS, browsers are affected?
All
Is there anything else we should know?
The text was updated successfully, but these errors were encountered: