Fixed Active User Upgrade Date Calendar Shows After Edit Cancel


Well-known member
If you're on the Active User Upgrade page, click 'Edit' for the first user in the list then click 'Cancel'. The date selection calendar will show on the page. You can click anywhere on the page to clear the calendar from view.


Chris D

XenForo developer
Staff member
I think this is a caching issue.

I'm not sure exactly what version, possibly 1.4 Beta 1 or one of the early betas, some code was added to the dateinput JS to handle this particular case (form resets focusing the date input field).

I was surprised a moment ago to see I could reproduce this on my own site; but after a few hard refreshes I couldn't reproduce it again. Hence my belief it's a browser cache issue.

Chris D

XenForo developer
Staff member
Actually, randomly, it seems I can reproduce it; despite this code which should handle it:
// this is needed to handle input[type=reset] buttons that end up focusing the field
$date.closest('form').on('reset', function() {
    setTimeout(function() {
    }, 0);

Chris D

XenForo developer
Staff member
I was intrigued because I had to reproduce some of this code for my own add-on which displays month / year selectors in the calendar. I observe the same behaviour.

It's basically a race condition where the calendar seems to be hidden before it is shown again.

There might be a better fix, but setting the timeout to 5 seems to do the trick.


XenForo developer
Staff member
I've done 2 levels with this -- one at 10 and one at 100. Strictly speaking, it seems like the reset event fires before it actually does the reset, so I'm not sure that 10 would automatically cover it in all scenarios (all machines, phones, etc). So the 10ms delay should catch it, but there isn't really a harm to closing it again at 100ms (unless you've managed to re-open the input in a tenth of a second ;)).