Handles mouse presses on the trigger.
(event: MouseEvent)
| 160 | |
| 161 | /** Handles mouse presses on the trigger. */ |
| 162 | _handleMousedown(event: MouseEvent): void { |
| 163 | if (!isFakeMousedownFromScreenReader(event)) { |
| 164 | // Since right or middle button clicks won't trigger the `click` event, |
| 165 | // we shouldn't consider the menu as opened by mouse in those cases. |
| 166 | this._openedBy = event.button === 0 ? 'mouse' : undefined; |
| 167 | |
| 168 | // Since clicking on the trigger won't close the menu if it opens a sub-menu, |
| 169 | // we should prevent focus from moving onto it via click to avoid the |
| 170 | // highlight from lingering on the menu item. |
| 171 | if (this.triggersSubmenu()) { |
| 172 | event.preventDefault(); |
| 173 | } |
| 174 | } |
| 175 | } |
| 176 | |
| 177 | /** Handles key presses on the trigger. */ |
| 178 | _handleKeydown(event: KeyboardEvent): void { |
nothing calls this directly
no test coverage detected