Commit 88cf7591 authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Fix dropdown closing when mouseup is outside

Changes the document event listener to listen to
mousedown instead of click
parent b3412033
...@@ -60,7 +60,7 @@ class DropLab { ...@@ -60,7 +60,7 @@ class DropLab {
addEvents() { addEvents() {
this.eventWrapper.documentClicked = this.documentClicked.bind(this); this.eventWrapper.documentClicked = this.documentClicked.bind(this);
document.addEventListener('click', this.eventWrapper.documentClicked); document.addEventListener('mousedown', this.eventWrapper.documentClicked);
} }
documentClicked(e) { documentClicked(e) {
...@@ -74,7 +74,7 @@ class DropLab { ...@@ -74,7 +74,7 @@ class DropLab {
} }
removeEvents() { removeEvents() {
document.removeEventListener('click', this.eventWrapper.documentClicked); document.removeEventListener('mousedown', this.eventWrapper.documentClicked);
} }
changeHookList(trigger, list, plugins, config) { changeHookList(trigger, list, plugins, config) {
......
---
title: Fix dropdowns closing when click is released outside the dropdown
merge_request: 32084
author:
type: fixed
...@@ -73,7 +73,7 @@ shared_examples 'thread comments' do |resource_name| ...@@ -73,7 +73,7 @@ shared_examples 'thread comments' do |resource_name|
expect(page).not_to have_selector menu_selector expect(page).not_to have_selector menu_selector
find(toggle_selector).click find(toggle_selector).click
execute_script("document.querySelector('body').click()") find("#{form_selector} .note-textarea").click
expect(page).not_to have_selector menu_selector expect(page).not_to have_selector menu_selector
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment