quasar icon indicating copy to clipboard operation
quasar copied to clipboard

Multiple Selection Date Picker weird behavior

Open qashier-ray-foo opened this issue 1 year ago • 2 comments

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

qashier-ray-foo avatar Mar 29 '23 08:03 qashier-ray-foo

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. 👏

github-actions[bot] avatar Mar 29 '23 08:03 github-actions[bot]

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

daya0576 avatar May 01 '24 00:05 daya0576