Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple Selection Date Picker weird behavior #15637

Open
qashier-ray-foo opened this issue Mar 29, 2023 · 2 comments
Open

Multiple Selection Date Picker weird behavior #15637

qashier-ray-foo opened this issue Mar 29, 2023 · 2 comments

Comments

@qashier-ray-foo
Copy link

What happened?

Let's say I am using a multiple-selection date picker and unselected a date, currently now it will auto focus to the last element

What did you expect to happen?

When unselect a date, no auto focus/navigation should happen and I am still able to select other dates in the same month

Reproduction URL

https://quasar.dev/vue-components/date#multiple-selection

How to reproduce?

  1. Select any date
  2. Select another date in different month/year
  3. Unselect the date you just selected
  4. You will see it will auto focus to the first date you selected

Flavour

Vue CLI Plugin (vue-cli-plugin-quasar)

Areas

Components (quasar)

Platforms/Browsers

Chrome

Quasar info output

No response

Relevant log output

No response

Additional context

No response

@github-actions
Copy link

Hi @qashier-ray-foo! 👋

It looks like you provided an invalid or unsupported reproduction URL.
Do not use any service other than Codepen, jsFiddle, StackBlitz, Codesandbox, and GitHub.
Make sure the URL you provided is correct and reachable. You can test it by visiting it in a private tab, another device, etc.
Please edit your original post above and provide a valid reproduction URL as explained.

Without a proper reproduction, your issue will have to get closed.

Thank you for your collaboration. 👏

@daya0576
Copy link

daya0576 commented May 1, 2024

    function getViewModel (mask, locale) {
      const model = Array.isArray(props.modelValue) === true
        ? props.modelValue
        : (props.modelValue ? [ props.modelValue ] : [])

      if (model.length === 0) {
        return getDefaultViewModel()
      }

      const target = model[ model.length - 1 ]
      const decoded = decodeString(
        target.from !== void 0 ? target.from : target,
        mask,
        locale
      )

      return decoded.dateHash === null
        ? getDefaultViewModel()
        : decoded
    }

After checking the source code, my current tricky workaround: adding an invalid date to the end of qdate value, e.g. ["2024/05/01", "2024/05/02", "foo"], then the default-year-month param will take effect and disable auto focus.

Of course, it would be great if an option was available to control this behaviour...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants