@bobfrankston/rmfmail 1.0.648 → 1.0.650

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/client/app.ts +15 -11
  2. package/package.json +1 -1
package/client/app.ts CHANGED
@@ -2685,22 +2685,26 @@ viewBtn?.addEventListener("click", (e) => {
2685
2685
  restoreToolbarDropdown("view-dropdown", "view-menu");
2686
2686
  if (viewDropdown) viewDropdown.hidden = !viewDropdown.hidden;
2687
2687
  });
2688
- document.addEventListener("click", (e) => {
2689
- // Only close when the click is genuinely outside the menu container.
2690
- // The earlier unconditional close had two problems: clicks on radio
2691
- // buttons / checkboxes INSIDE the menu also closed it (so the user
2692
- // couldn't toggle anything without reopening), and any handler
2693
- // upstream that consumed the event (preventDefault paths, focus
2694
- // shifts) could keep the menu open inappropriately. The closest()
2695
- // check ensures inside-clicks pass through and outside-clicks close.
2688
+ // Capture-phase pointerdown so we run BEFORE any handler that calls
2689
+ // stopPropagation. The earlier bubble-phase click listener missed clicks
2690
+ // when an upstream handler swallowed propagation, and the menu stayed open.
2691
+ // pointerdown also feels snappier than waiting for click (which fires on
2692
+ // pointerup). The closest() checks let inside-clicks (radio buttons,
2693
+ // checkboxes, the input) keep the menu open.
2694
+ document.addEventListener("pointerdown", (e) => {
2696
2695
  const target = e.target as HTMLElement | null;
2697
- if (viewDropdown && !viewDropdown.hidden && !target?.closest("#view-menu") && !target?.closest("#view-dropdown")) {
2696
+ if (!target) return;
2697
+ // Don't close if the click is on the toolbar button that toggles us —
2698
+ // its own handler will run after this and toggle, otherwise we'd
2699
+ // close-then-reopen-then-close.
2700
+ if (target.closest("#btn-view, #btn-settings, #rail-view, #rail-settings, #rail-menu-backdrop")) return;
2701
+ if (viewDropdown && !viewDropdown.hidden && !target.closest("#view-menu") && !target.closest("#view-dropdown")) {
2698
2702
  viewDropdown.hidden = true;
2699
2703
  }
2700
- if (settingsDropdown && !settingsDropdown.hidden && !target?.closest("#settings-menu") && !target?.closest("#settings-dropdown")) {
2704
+ if (settingsDropdown && !settingsDropdown.hidden && !target.closest("#settings-menu") && !target.closest("#settings-dropdown")) {
2701
2705
  settingsDropdown.hidden = true;
2702
2706
  }
2703
- });
2707
+ }, true);
2704
2708
  // Escape always closes any open dropdown/backdrop, regardless of how it was
2705
2709
  // opened or whether an outside-click handler missed firing. Last-resort
2706
2710
  // escape hatch for the "stuck modal" case.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bobfrankston/rmfmail",
3
- "version": "1.0.648",
3
+ "version": "1.0.650",
4
4
  "description": "Local-first email client with IMAP sync and standalone native app",
5
5
  "type": "module",
6
6
  "main": "bin/mailx.js",