tray tooltips: tilt persists while portal is open; PRV|NXT pinned to corners — TDD

- TrayTooltip adds .tt-active to the .tray-role-card / .tray-sig-card cell while its tooltip is open & removes it on _hide. The hover-tilt selectors gain .tt-active alongside :hover, :focus so the card stays tilted while the user is hovering the portal itself rather than the cell.
- #id_tooltip_portal: .fyi-prev / .fyi-next pinned to the bottom corners w. 1rem outside the panel (bottom: -1rem; left/right: -1rem) — same anchor the @stat-block-shared mixin uses for fan / sig / sea, restated here since the portal isn't covered by that mixin.
- 2 new TrayTooltipSpec specs (.tt-active added on hover, removed on _hide; for both role & sig branches).

Code architected by Disco DeDisco <discodedisco@outlook.com>
Git commit message Co-Authored-By:
Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Disco DeDisco
2026-05-03 21:18:09 -04:00
parent b29bcf5c38
commit 9b93b9d31b
5 changed files with 120 additions and 3 deletions

View File

@@ -22,6 +22,7 @@
var TrayTooltip = (function () {
var _portal = null;
var _activeTrig = null;
var _activeCell = null; // .tray-role-card / .tray-sig-card holding the tilt class
var _activeKind = null; // "role" | "sig"
var _infoData = [];
var _infoIdx = 0;
@@ -37,12 +38,20 @@ var TrayTooltip = (function () {
_portal.classList.remove("active");
_portal.style.display = "none";
_portal.innerHTML = "";
if (_activeCell) _activeCell.classList.remove("tt-active");
_activeCell = null;
_activeTrig = null;
_activeKind = null;
_infoData = [];
_infoIdx = 0;
}
// Find the .tray-role-card / .tray-sig-card ancestor of a trigger so we
// can keep its hover-tilt locked while the portal is open.
function _cellOf(triggerEl) {
return triggerEl.closest && triggerEl.closest(".tray-role-card, .tray-sig-card");
}
function _position(triggerEl) {
var triggerRect = triggerEl.getBoundingClientRect();
var halfW = _portal.offsetWidth / 2;
@@ -69,6 +78,8 @@ var TrayTooltip = (function () {
_portal.style.display = "block";
_activeTrig = triggerEl;
_activeKind = "role";
_activeCell = _cellOf(triggerEl);
if (_activeCell) _activeCell.classList.add("tt-active");
_position(triggerEl);
}
@@ -107,6 +118,8 @@ var TrayTooltip = (function () {
_portal.style.display = "block";
_activeTrig = triggerEl;
_activeKind = "sig";
_activeCell = _cellOf(triggerEl);
if (_activeCell) _activeCell.classList.add("tt-active");
_portal.querySelector(".fyi-prev").addEventListener("click", function (e) {
e.stopPropagation();