diff --git a/examples/crash_reporter/backend/public/assets/css/app.css b/examples/crash_reporter/backend/public/assets/css/app.css index 226913b..374deab 100644 --- a/examples/crash_reporter/backend/public/assets/css/app.css +++ b/examples/crash_reporter/backend/public/assets/css/app.css @@ -469,15 +469,20 @@ a:hover { text-decoration: underline; } padding-right: 8px; min-height: 1.5rem; } -.th-drag { +.data-table th.th-draggable { cursor: grab; + user-select: none; +} +.data-table th.th-draggable:active { + cursor: grabbing; +} +.th-drag { color: var(--muted); font-size: 11px; letter-spacing: -2px; user-select: none; flex-shrink: 0; } -.th-drag:active { cursor: grabbing; } .th-label { flex: 1; min-width: 0; } .th-draggable.th-dragging { opacity: .45; } .th-draggable.th-dragging .th-label { diff --git a/examples/crash_reporter/backend/public/assets/js/app.js b/examples/crash_reporter/backend/public/assets/js/app.js index 5ae83c2..0a999d0 100644 --- a/examples/crash_reporter/backend/public/assets/js/app.js +++ b/examples/crash_reporter/backend/public/assets/js/app.js @@ -350,13 +350,17 @@ table.dataset.layoutBound = '1'; thead.addEventListener('dragstart', (e) => { - const handle = e.target.closest('.th-drag'); - if (!handle || ctx.getGrouped()) return; - const sourceKey = handle.getAttribute('data-col-key'); + if (ctx.getGrouped()) return; + if (e.target.closest('.col-resizer')) { + e.preventDefault(); + return; + } + const th = e.target.closest('th.th-draggable[data-col-key]'); + if (!th) return; + const sourceKey = th.getAttribute('data-col-key'); if (!sourceKey) return; table.dataset.dragColKey = sourceKey; - const th = handle.closest('th'); - if (th) th.classList.add('th-dragging'); + th.classList.add('th-dragging'); const label = columnLabelByKey(sourceKey); const ghost = document.createElement('div'); ghost.className = 'col-drag-ghost'; @@ -698,16 +702,19 @@ active ? (dir === 'asc' ? '▲' : '▼') : '↕'; const w = widths[c.key] ? ' style="width:' + widths[c.key] + 'px"' : ''; let thClass = 'sortable' + (active ? ' sortable--active' : ''); - let thDrag = ''; + let thDragAttrs = ''; if (!grouped) { thClass += ' th-draggable'; - thDrag = ' data-col-key="' + escapeHtml(c.key) + '"'; + thDragAttrs = + ' draggable="true" data-col-key="' + + escapeHtml(c.key) + + '" title="Drag column to reorder"'; } html += '