themesberg / flowbite-svelte

Official Svelte components built for Flowbite and Tailwind CSS
https://flowbite-svelte.com
MIT License
2.24k stars 274 forks source link

Datepicker is closing when clicking any of the buttons #1475

Closed bmanth60 closed 4 weeks ago

bmanth60 commented 4 weeks ago

Describe the bug

When I use the datepicker, clicking on any buttons in the popup is closing my picker prematurely.

https://github.com/user-attachments/assets/0602506b-5eee-4a02-93a3-e6f0b10927ae

I am wondering if this logic is incorrect: https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/datepicker/Datepicker.svelte#L153 since the datepicker widget is not nested within the input, and it shouldn't be: https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/datepicker/Datepicker.svelte#L255

PR https://github.com/themesberg/flowbite-svelte/pull/1476 adds a ref to the top level datepicker widget for to check for click outside of the container element rather than the input.

Reproduction

  1. Clone https://github.com/bmanth60/flowbite-svelte-issue-template/tree/bmanth60/patch-91061
  2. Click on the datepicker
  3. Select next month

Flowbite version and System Info

System:
    OS: Linux 5.15 Ubuntu 22.04.5 LTS 22.04.5 LTS (Jammy Jellyfish)
    CPU: (24) x64 12th Gen Intel(R) Core(TM) i9-12900K
    Memory: 11.90 GB / 15.49 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 20.17.0 - ~.nvm/versions/node/v20.17.0/bin/node
    npm: 10.8.2 - ~.nvm/versions/node/v20.17.0/bin/npm
  npmPackages:
    @sveltejs/kit: ^2.0.0 => 2.7.2
    flowbite-svelte: ^0.47.2 => 0.47.2
    svelte: ^5.1.2 => 5.1.2
    vite: ^5.0.3 => 5.4.9