fix(views/board): unable to click while editing column

This commit is contained in:
Elian Doran 2025-07-25 16:29:25 +03:00
parent 9589164008
commit e851701a9e
No known key found for this signature in database
2 changed files with 29 additions and 2 deletions

View File

@ -24,7 +24,12 @@ export class ColumnDragHandler implements BaseDragHandler {
// Delay drag start to allow click detection // Delay drag start to allow click detection
let dragStartTimer: number | null = null; let dragStartTimer: number | null = null;
$titleEl.on("mousedown", () => { $titleEl.on("mousedown", (e) => {
// Don't interfere with editing mode or input field interactions
if ($titleEl.hasClass('editing') || $(e.target).is('input')) {
return;
}
// Clear any existing timer // Clear any existing timer
if (dragStartTimer) { if (dragStartTimer) {
clearTimeout(dragStartTimer); clearTimeout(dragStartTimer);
@ -38,7 +43,12 @@ export class ColumnDragHandler implements BaseDragHandler {
}, 150); }, 150);
}); });
$titleEl.on("mouseup mouseleave", () => { $titleEl.on("mouseup mouseleave", (e) => {
// Don't interfere with editing mode
if ($titleEl.hasClass('editing') || $(e.target).is('input')) {
return;
}
// Cancel drag start timer on mouse up or leave // Cancel drag start timer on mouse up or leave
if (dragStartTimer) { if (dragStartTimer) {
clearTimeout(dragStartTimer); clearTimeout(dragStartTimer);

View File

@ -363,6 +363,12 @@ export default class BoardView extends ViewMode<BoardData> {
// Handle column title editing with click detection that works with dragging // Handle column title editing with click detection that works with dragging
this.$container.on('mousedown', 'h3[data-column-value]', (e) => { this.$container.on('mousedown', 'h3[data-column-value]', (e) => {
const $titleEl = $(e.currentTarget); const $titleEl = $(e.currentTarget);
// Don't interfere with editing mode
if ($titleEl.hasClass('editing') || $(e.target).is('input')) {
return;
}
const startTime = Date.now(); const startTime = Date.now();
let hasMoved = false; let hasMoved = false;
const startX = e.clientX; const startX = e.clientX;
@ -419,12 +425,20 @@ export default class BoardView extends ViewMode<BoardData> {
const $titleSpan = $titleEl.find("span").first(); // Get the text span const $titleSpan = $titleEl.find("span").first(); // Get the text span
const currentTitle = $titleSpan.text(); const currentTitle = $titleSpan.text();
$titleEl.addClass("editing"); $titleEl.addClass("editing");
// Disable dragging while editing
$titleEl.attr("draggable", "false");
const $input = $("<input>") const $input = $("<input>")
.attr("type", "text") .attr("type", "text")
.val(currentTitle) .val(currentTitle)
.attr("placeholder", "Column title"); .attr("placeholder", "Column title");
// Prevent events from bubbling to parent drag handlers
$input.on('mousedown mouseup click', (e) => {
e.stopPropagation();
});
$titleEl.empty().append($input); $titleEl.empty().append($input);
$input.focus().select(); $input.focus().select();
@ -434,6 +448,9 @@ export default class BoardView extends ViewMode<BoardData> {
} }
$titleEl.removeClass("editing"); $titleEl.removeClass("editing");
// Re-enable dragging after editing
$titleEl.attr("draggable", "true");
let finalTitle = currentTitle; let finalTitle = currentTitle;
if (save) { if (save) {