Skip to content

The Unified and Autonomous Development Platform

fix: Allow editing enumeration fields on mobile

aibot9f5c5d1f90ee
diff --git a/server-core/src/main/java/io/onedev/server/web/component/floating/floating.js b/server-core/src/main/java/io/onedev/server/web/component/floating/floating.js
index a73e9c27ce..96046d35cf 100644
--- a/server-core/src/main/java/io/onedev/server/web/component/floating/floating.js
+++ b/server-core/src/main/java/io/onedev/server/web/component/floating/floating.js
@@ -7,7 +7,8 @@ onedev.server.floating = {
$floating.data("mouseUpOrTouchStart", function(e) {
if ($(".flatpickr-calendar.open").length == 0
&& $(".pcr-app.visible").length == 0
- && $floating.find(".dropdown-open").length == 0) {
+ && $floating.find(".dropdown-open").length == 0
+ && $(".select2-drop:visible").length == 0) {
/*
* Close the floating panel if mouse clicks outside of the floating. Also we
* do not close the panel if mouse clicks on the element triggering this
diff --git a/server-core/src/main/java/io/onedev/server/web/component/select2/res/select2.js b/server-core/src/main/java/io/onedev/server/web/component/select2/res/select2.js
index bb488064e6..06eef1f355 100644
--- a/server-core/src/main/java/io/onedev/server/web/component/select2/res/select2.js
+++ b/server-core/src/main/java/io/onedev/server/web/component/select2/res/select2.js
@@ -701,17 +701,22 @@ the specific language governing permissions and limitations under the Apache Lic
search.bind("focus", function () { search.addClass("select2-focused"); });
search.bind("blur", function () { search.removeClass("select2-focused");});
- this.dropdown.delegate(resultsSelector, "mouseup", this.bind(function (e) {
+ var selectHighlightedResult = this.bind(function (e) {
if ($(e.target).closest(".select2-result-selectable").length > 0) {
this.highlightUnderEvent(e);
this.selectHighlighted(e);
}
+ });
+ this.dropdown.delegate(resultsSelector, "mouseup", selectHighlightedResult);
+ this.dropdown.delegate(resultsSelector, "touchend", this.bind(function (e) {
+ selectHighlightedResult(e);
+ e.preventDefault();
}));
// trap all mouse events from leaving the dropdown. sometimes there may be a modal that is listening
// for mouse events outside of itself so it can close itself. since the dropdown is now outside the select2's
// dom it will trigger the popup close, which is not what we want
- this.dropdown.bind("click mouseup mousedown", function (e) { e.stopPropagation(); });
+ this.dropdown.bind("click mouseup mousedown touchstart", function (e) { e.stopPropagation(); });
if ($.isFunction(this.opts.initSelection)) {
// initialize selection based on the current value of the source element
diff --git a/server-core/src/main/java/io/onedev/server/web/component/sideinfo/side-info.js b/server-core/src/main/java/io/onedev/server/web/component/sideinfo/side-info.js
index 115754b107..bb9b264ada 100644
--- a/server-core/src/main/java/io/onedev/server/web/component/sideinfo/side-info.js
+++ b/server-core/src/main/java/io/onedev/server/web/component/sideinfo/side-info.js
@@ -4,7 +4,8 @@ onedev.server.sideInfo = {
$(document).on("mouseup touchstart", function(e) {
if ($(".flatpickr-calendar.open").length == 0
&& $(".pcr-app.visible").length == 0
- && $container.find(".dropdown-open").length == 0) {
+ && $container.find(".dropdown-open").length == 0
+ && $(".select2-drop:visible").length == 0) {
var x = e.pageX;
var y = e.pageY;