mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-27 16:02:26 +00:00
Opening the login modal's unlock-saved-key (nsec passphrase/PIN) field on top of the profile modal left it unclickable/untypable. The profile modal's document-level focusin trap yanks focus back to itself whenever focus leaves the modal — but it didn't recognize a modal STACKED on top (the login modal is also a .bv-modal), so it stole focus away from the PIN field the moment it was clicked. Fix: the focusin trap now yields when the focus target is inside a different OPEN .bv-modal (isInStackedModal, extracted to js/ui/focusTrapStacking.js so it's unit- testable without constructing the whole controller). The stacked login modal keeps focus and the field is typable again. This also makes the trap robust for any future stacked modal, not just the #36 re-unlock flow. Test: tests/focus-trap-stacking.test.mjs (5 — yields to an open stacked modal's field; does not yield within the trapping modal, to a hidden modal, to a bare target, or on a null/non-element). Build + lint clean; profile-modal suite green. Co-Authored-By: Claude Opus 4.8 <[email protected]>