SilkUI Calendar autoClose

SilkUI Calendar autoClose


I'm trying to make the calendar hide itself once the user tabs out of its input. After a little digging, I found this on the pikaday script.

self._onInputBlur = function(){
    // IE allows pika div to gain focus; catch blur the input field
    var pEl = document.activeElement;
    do {
      if (hasClass(pEl, 'pika-single')) {
    while ((pEl = pEl.parentNode));

    if (opts.autoClose && !self._c) {
      self._b = sto(function() {
      }, 50);
    self._c = false;

Why would self.hide() be commented out? Doesn't that break this functionality? Is there any way to hide the calendar when the input is blured (the user tabs out of it)?

Hello Pedro,

Assuming that you are using Silk Web, 

This code was commented out in order to mimic the behavior of previous calendar that we had (in which, if we had 'showTime' and we clicked on a day it would not close the calendar). However, we understand your use case and we'll work on a fix to be available on the next version.

What is your platform version?

Hi Rita,

For now, I solved it by copying the original pattern form a SilkUI clone and "de-commenting" it. So far it looks good, even with timepicking. It never loses focus until TAB out or click somewhere else, even while picking a timestamp.

I'm using Service Studio (up to date) and every dependency is updated.


So, if you are using version 10, then you can get the latest version of Silk (that has been released this afternoon) and the calendar there has already the fix for the 'tab' :)