1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Fixed Active User Upgrade Date Calendar Shows After Edit Cancel

Discussion in 'Resolved Bug Reports' started by Snog, Sep 9, 2014.

  1. Snog

    Snog 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.

  2. Chris D

    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.
  3. Chris D

    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);
  4. Chris D

    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.
  5. Mike

    Mike 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 ;)).
    Chris D likes this.

Share This Page