Web: date picker commits on leave, close day context menu on event click

- Date picker: clicking a day only selects it now; the choice is committed
  when you leave the picker (click outside) or press Save — for both date and
  datetime modes (previously datetime discarded on click-away, and date
  committed instantly on click, neither of which was wanted).
- The day right-click context menu ("Neuen Termin erstellen") now closes when
  an event popup opens (the event row stops propagation, so its own
  outside-click closer never fired).
- version v47 -> v48.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Scarriffle
2026-06-09 21:32:51 +02:00
parent 367087450e
commit 0c8fbb86e8
3 changed files with 9 additions and 7 deletions

View File

@@ -1373,6 +1373,9 @@ function showDayContextMenu(date, mouseEvent) {
// ── Event Popup ───────────────────────────────────────────
function showEventPopup(ev, anchor) {
// The event row stops click propagation, so the day context menu's own
// outside-click closer never fires — remove it explicitly here.
document.querySelectorAll('.cal-context-menu').forEach(m => m.remove());
const popup = document.getElementById('popup-event');
document.getElementById('popup-copy-menu').classList.add('hidden');
popup.classList.remove('hidden');

View File

@@ -48,9 +48,10 @@ export function openDatePicker(anchor, value, mode = 'datetime') {
resolve(result);
}
// Click outside → cancel
// Click outside (leaving the picker) → commit the current selection,
// rather than discarding it. Cancel button still reverts.
overlay.addEventListener('mousedown', e => {
if (e.target === overlay) done(null);
if (e.target === overlay) done(buildResult());
});
// ── Calendar builder ──────────────────────────────────
@@ -144,13 +145,11 @@ export function openDatePicker(anchor, value, mode = 'datetime') {
render();
};
// Day click
// Day click → just select/highlight; committing happens on Save or when
// the user leaves the picker (clicks outside).
card.querySelectorAll('.dtp-day').forEach(el => {
el.addEventListener('click', () => {
selDate = new Date(parseInt(el.dataset.ts));
// In date-only mode there's nothing else to choose — commit the day
// immediately instead of forcing an extra "Save" click.
if (mode === 'date') { done(buildResult()); return; }
if (el.classList.contains('other')) {
viewYear = selDate.getFullYear();
viewMonth = selDate.getMonth();

View File

@@ -1,2 +1,2 @@
// Increment APP_VERSION with every code change
export const APP_VERSION = 'v47';
export const APP_VERSION = 'v48';