Skip to content

Fix dropdown closing when mouseup is outside

Heinrich Lee Yu requested to merge fix-dropdown-closing into master

What does this MR do?

Fixes an annoying behavior where dropdowns are closed when mousedown is inside the dropdown but mouseup is outside.

This happens very frequently for me when copying / editing a long branch name in the "Create merge request" dropdown:

Screen_Recording_2019-08-22_at_1.55.36_PM

This MR changes the event listened to mousedown instead of click so that this doesn't happen.

A side-effect: Right-clicking outside the dropdown now closes the dropdown. We could add some code in the event handler to prevent this but I think it's okay to close it if we right click outside.

This was discussed in https://gitlab.slack.com/archives/CETG54GQ0/p1566425318367100

Does this MR meet the acceptance criteria?

Conformity

Performance and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by Heinrich Lee Yu

Merge request reports

Loading