material icon indicating copy to clipboard operation
material copied to clipboard

feat(menu): add ability to specify md-no-backdrop to disable backdrop

Open totomaze opened this issue 7 years ago • 3 comments

Bug, feature request, or proposal: Bug

What is the expected behavior? When menu is open, any click event (including context menu events) outside of the menu and targeting clickable items, is expected to work from the first time. Menu should be closed along with the action handled by the clicked item. Maybe the close menu shouldn't be handled when clicking on the backdrop but when its outside the menu, or the backdrop should propagate the click event. Same problem with autocomplete.

What is the current behavior? Overlay is blocking click events (context menu events). Clicking on the overlay first closes the menu and the user needs to click again to do his desired action (e.g. clicking navigation item that).

What are the steps to reproduce? Go to documents/demo page. Navigate to Components -> Menu Click on the first example for demo Try to click any other component page from the left navigation - Component page will open after second click attempt ( after the menu is closed ).

What is the use-case or motivation for changing an existing behavior? The current functionality is a bad UX decision. Users usually expect to execute actions with one click (closing menu is counted towards the executed action). Making the user to click twice to close the menu and then proceed to the desired action is frustrating and not likely acceptable by most projects.

It also causes issues if developers want to do custom context menu with the Menu component.

Ugly workarounds :

$scope.openMenu=function($mdMenu){
	    	$mdMenu.open();
	    	$scope.modifyClickCatcher();
	    }
$scope.modifyClickCatcher=function(){
	    	console.log('find click-catcher');
	    	setTimeout(function(){
	    		var back=$( ".md-click-catcher");
	    		
		    	 back.click(function() {
		    		 console.log('clicked in click-catcher')
		    		 	var posX = event.clientX, posY = event.clientY;
		    		 	setTimeout(function(){document.elementFromPoint(posX, posY).click()},200);
		    		});
	    		},400);
	    }

For md-select ;

<md-select ng-click="modifyClickCatcher();" .../>

For autocomplete I don't have workaround (if I remove the md-scroll-mask some problems appear with the scrolling).

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

Angular 1.6.7 Material 1.1.10

totomaze avatar Sep 13 '18 03:09 totomaze

For md-select, issue https://github.com/angular/material/issues/11346 already tracks this issue. We're waiting on a PR from the community to add that functionality.

For md-autocomplete, I cannot reproduce this issue in https://material.angularjs.org/1.1.10/demo/autocomplete. After I open the dropdown, the first click on the left nav menu causes navigation.

Splaktar avatar Sep 17 '18 20:09 Splaktar

For md-autocomplete, try to click on view source when the autocomplete is open I think the z-index of the navigation is higher than the scroll-mask , that's why it s working the button are behind the scroll-mask https://material.angularjs.org/1.1.10/demo/autocomplete.

For md-autocomplete, I cannot reproduce this issue in https://material.angularjs.org/1.1.10/demo/autocomplete. After I open the dropdown, the first click on the left nav menu causes navigation.

totomaze avatar Sep 21 '18 02:09 totomaze

OK, @totomaze I see what you mean now after doing some additional testing using the buttons or checkboxes on the page.

I've updated this issue's title to cover md-menu as it uses md-backdrop. Please open a separate issue for md-autocomplete and in it reference this issue and the md-select issue. Note that a solution for md-autocomplete will be different as it uses the md-scroll-mask instead of md-backdrop.

Splaktar avatar Sep 27 '18 20:09 Splaktar