themesberg / flowbite-svelte

Official Svelte components built for Flowbite and Tailwind CSS

Home Page:https://flowbite-svelte.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Datepicker is closing when clicking any of the buttons

bmanth60 opened this issue · comments

Describe the bug

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

Recording.2024-10-29.105542.mp4

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 #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