Skip to content

Commit

Permalink
Fix for hook position in wide column names, refs #2263
Browse files Browse the repository at this point in the history
  • Loading branch information
simonw committed Feb 19, 2024
1 parent 392ca2e commit 27409a7
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion datasette/static/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,15 @@ const initDatasetteTable = function (manager) {
const hook = menu.querySelector('.hook');
const icon = th.querySelector('.dropdown-menu-icon');
const iconRect = icon.getBoundingClientRect();
hook.style.left = (iconRect.left - menuLeft + 1) + 'px';
const hookLeft = (iconRect.left - menuLeft + 1) + 'px';
hook.style.left = hookLeft;
// Move the whole menu right if the hook is too far right
const menuRect = menu.getBoundingClientRect();
if (iconRect.right > menuRect.right) {
menu.style.left = (iconRect.right - menuWidth) + 'px';
// And move hook tip as well
hook.style.left = (menuWidth - 13) + 'px';
}
}

var svg = document.createElement("div");
Expand Down

0 comments on commit 27409a7

Please sign in to comment.