flowbite icon indicating copy to clipboard operation
flowbite copied to clipboard

Datepicker doesn't hide on date selection with autohide true

Open aroncal opened this issue 2 years ago • 0 comments

Describe the bug Datepicker doesn't hide on date selection ('onChangeDate' event) with autohide=true.

Expected behavior It should hide.

Desktop (please complete the following information):

  • OS: Macos 13.5.2
  • Browser : Chrome 118.0.5993.117
  • Version: flowbite-datepicker 1.2.4

Additional context Inspecting /node_modules/flowbite-datepicker/dist/js/datepicker-full.js I see this 'hide' function:

    hide() {
      if (!this.active) {
        return;
      }
      this.datepicker.exitEditMode();
      this.element.classList.remove('active', 'block');
      this.element.classList.add('active', 'block', 'hidden');
      this.active = false;
      triggerDatepickerEvent(this.datepicker, 'hide');
    }

I think the line in which classes are added, 'active' and 'block' shouldn't be there. If I remove them, it works as expected, like this:

    hide() {
      if (!this.active) {
        return;
      }
      this.datepicker.exitEditMode();
      this.element.classList.remove('active', 'block');
      this.element.classList.add('hidden');
      this.active = false;
      triggerDatepickerEvent(this.datepicker, 'hide');
    }

aroncal avatar Nov 08 '23 14:11 aroncal