(core) Avoid editing fields on toggle dbclick

Summary:
This prevents a quirky UI behavior where double-clicking a toggle would cause
the field to start being edited.

Test Plan: Browser tests.

Reviewers: jarek

Reviewed By: jarek

Differential Revision: https://phab.getgrist.com/D4093
This commit is contained in:
George Gevoian
2023-10-25 11:04:40 -04:00
parent 4e67c679b2
commit ce23887be0
2 changed files with 29 additions and 21 deletions

View File

@@ -473,14 +473,15 @@ DetailView.prototype._duplicateRows = async function() {
}
DetailView.prototype._canSingleClick = function(field) {
// we can't simple click if :
// we can't single click if :
// - the field is a formula
// - the field is toggle (switch or checkbox)
if (
field.column().isRealFormula() || field.column().hasTriggerFormula()
|| (
field.column().pureType() === "Bool"
&& ["Switch", "CheckBox"].includes(field.column().visibleColFormatter().widgetOpts.widget)
field.column().isRealFormula() ||
field.column().hasTriggerFormula() ||
(
field.column().pureType() === "Bool" &&
["Switch", "CheckBox"].includes(field.visibleColFormatter().widgetOpts.widget)
)
) {
return false;