fix: Escolher datas stays open when the numbers reload (tab opened, 7/30/90, the 30 s refresh)
All checks were successful
Build and deploy / Validate source (push) Successful in 5s
Build and deploy / Integration suite on a real stack (push) Successful in 7m55s
Build and deploy / Secret scan and release gate (push) Successful in 5s
Build and deploy / Publish images (push) Successful in 1m1s

statsPeriod redrew the period bar with replaceChildren, which dropped an open
calendar. On a phone the numbers' reply often lands after the tap, so the
calendar opened and vanished at once: "Escolher datas" seemed to do nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-12-01 11:41:08 -03:00
parent 2c0dd72098
commit c2ffe08db5

View File

@@ -30,7 +30,11 @@ function statsPeriod(){
const open=node('button',undefined,'btn'+(statsRange?' on':''));open.type='button';open.setAttribute('aria-haspopup','dialog'); const open=node('button',undefined,'btn'+(statsRange?' on':''));open.type='button';open.setAttribute('aria-haspopup','dialog');
open.append(svgIcon(IC.calendar,'i m'),statsRange?shortDay(statsRange.start)+' a '+shortDay(statsRange.end):'Escolher datas'); open.append(svgIcon(IC.calendar,'i m'),statsRange?shortDay(statsRange.start)+' a '+shortDay(statsRange.end):'Escolher datas');
open.onclick=e=>{e.stopPropagation();const pop=wrap.querySelector('.pop');if(pop){pop.remove();return;}wrap.append(calendar());}; open.onclick=e=>{e.stopPropagation();const pop=wrap.querySelector('.pop');if(pop){pop.remove();return;}wrap.append(calendar());};
wrap.replaceChildren(open); // The numbers reload when the tab opens, on 7/30/90 and every 30 s: a
// calendar open meanwhile stays (on a phone the reply came after the tap
// and closed it, so "Escolher datas" seemed to do nothing).
const pop=wrap.querySelector('.pop');
wrap.replaceChildren(open,...(pop?[pop]:[]));
} }
// The calendar: presets on the left, a month where a click starts the // The calendar: presets on the left, a month where a click starts the
// period and the next one ends it. `single`, `future` and `time` add the // period and the next one ends it. `single`, `future` and `time` add the