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

Datepicker component no longer editable #881

Closed
theonelucas opened this issue Apr 2, 2024 · 4 comments · Fixed by #882 or #901
Closed

Datepicker component no longer editable #881

theonelucas opened this issue Apr 2, 2024 · 4 comments · Fixed by #882 or #901
Labels
bug Something isn't working

Comments

@theonelucas
Copy link

Overview of the problem

Oruga latest
Vuejs version: latest
OS/Browser: any

Description

In the vue 2 version of oruga, the o-datepicker component used to have a prop named editable, which as its name suggested, allowed for the inline editing of the date. Now, in the latest version of oruga for vue 3, that prop is gone, and the only prop that resembles that is readonly, which acts as the native readonly attribute.

Steps to reproduce

I created a sandbox reproducing the issue.

Expected behavior

When the date is inline edited, if the text is a valid date, it should be set as the date.

Actual behavior

The date is either not changed or emptied.

@blm768
Copy link
Contributor

blm768 commented Apr 2, 2024

A reproducible example:

<script setup lang="ts">
import { ODatepicker } from '@oruga-ui/oruga-next';
import { ref } from 'vue';

const date = ref(new Date());
const range = ref([new Date(), new Date()]);

</script>

<template>
  <OField label="Date">
    <ODatepicker v-model="date" :readonly="false" />
  </OField>
  <OField label="Date Range">
    <ODatepicker v-model="range" :readonly="false" range />
  </OField>
</template>

Trying to edit either date via the keyboard just clears it out once the control loses focus.

I suspect this logic is what's clearing the value.

@mlmoravek
Copy link
Member

@blm768 Thanks for the fix, seems good.

@theonelucas editable got renamed to readonly to get it inline with the other input components.

Maybe we should also change the default value of readonly to false instead of true? What do you think?

@mlmoravek mlmoravek added the bug Something isn't working label Apr 14, 2024
@blm768
Copy link
Contributor

blm768 commented Apr 16, 2024

Maybe we should also change the default value of readonly to false instead of true? What do you think?

That would be closer to the standard behavior of the readonly property, which defaults to false like all HTML Boolean attributes. The readonly property for ODatepicker really doesn't behave like it does for other inputs, though. If I were just looking at the HTML specification rather than the Oruga documentation, I'd expect <ODatepicker readonly> to not allow any kind of user input, not even via the pop-up picker.

@mlmoravek
Copy link
Member

mlmoravek commented Apr 16, 2024

Yeah you are right, that is how it should be. @blm768 Could you update your PR or make another one :)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants