Right-clicking on elements with "modal-trigger" class will open the modal in Firefox
Expected Behavior
The modal window should remain closed when right-clicking on the modal-trigger
Current Behavior
The modal window opens up as if normally clicked on the modal-trigger
Possible Solution
Steps to Reproduce (for bugs)
- Open http://materializecss.com/modals.html with Mozilla Firefox
- Right-Click on any of the 3 modal buttons
- Instead of only getting the right-click options menu the modal opens up as well
Context
Users are not able to use right-click menu options such as 'Inspect element' because of the modal window that opens up on top
Your Environment
- Version used: Materialize 0.100.1
- Browser Name and version: Mozilla Firefox 54.0.1
- Operating System and version (desktop or mobile): Windows 7 Desktop PC
- Link to your project (if appropriate): N/A
handleTriggerClick is bound to the document and is fired on rightclick, middleclick and so on in Gecko.
References:
https://github.com/Dogfalo/materialize/commit/2220501f05c8cb086060f0e2fa596d37aea4d7ed
https://github.com/jquery/jquery/blob/4d6b4536b2e0148d4b228884a0b356e73dd8beec/src/event.js#L371-L376
https://github.com/jquery/jquery/blob/4d6b4536b2e0148d4b228884a0b356e73dd8beec/src/event.js#L642
https://bugs.jquery.com/ticket/3861
https://stackoverflow.com/a/43147060/753676
https://developer.mozilla.org/en-US/docs/Web/Events
click A pointing device button (ANY button; soon to be primary button only) has been pressed and released on an element.
https://developer.mozilla.org/en-US/docs/Web/Events/click
button Read onlyunsigned shortThe button number that was pressed when the mouse event was fired: Left button=0, middle button=1 (if present), right button=2. For mice configured for left handed use in which the button actions are reversed the values are instead read from right to left.
buttons Read onlyunsigned shortThe buttons being pressed when the mouse event was fired: Left button=1, Right button=2, Middle (wheel) button=4, 4th button (typically, "Browser Back" button)=8, 5th button (typically, "Browser Forward" button)=16. If two or more buttons are pressed, returns the logical sum of the values. E.g., if Left button and Right button are pressed, returns 3 (=1 | 2). More info.
https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent
https://github.com/mozilla/gecko-dev/blob/eb9ee92c2ddecbdf2af706ecad8df3fbb955b084/widget/MouseEvents.h#L188
https://github.com/mozilla/gecko-dev/blob/051dc17e6ce191f489977ca7f8eca0d7cbad1e1f/dom/events/EventStateManager.cpp#L4683
Solution: filter the event (button/buttons/which).
c10b170218c0f333d3da4307e7ab1880c0c6532a