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

prevent calendar showing if readonly attribute is present on the input #2759

Open
2 tasks done
b1ade68 opened this issue Feb 7, 2023 · 4 comments
Open
2 tasks done

Comments

@b1ade68
Copy link

b1ade68 commented Feb 7, 2023

Prerequisites

Proposal

Software prevents opening the calendar if disabled attribute is present on the input. Why not also for readonly?

It is a simple change (perhaps). in tempus-dominus.ts we can change the function _toggleClickEvent :

private _toggleClickEvent = () => {
    if ((this.optionsStore.element as any)?.disabled || this.optionsStore.input?.disabled || this.optionsStore.input?.readOnly) return
    this.toggle();
  };

Motivation and context

Readonly input shuld not be changed.

@b1ade68 b1ade68 added the State: Triage Tickets that need to be triaged. label Feb 7, 2023
@b1ade68 b1ade68 changed the title prevent calendat showing if readonly attrivute is present on the input prevent calendar showing if readonly attrivute is present on the input Feb 7, 2023
@b1ade68 b1ade68 changed the title prevent calendar showing if readonly attrivute is present on the input prevent calendar showing if readonly attribute is present on the input Feb 7, 2023
@Eonasdan
Copy link
Owner

In other versions, this has been a bit of a back and forth with users. In some cases, people want it to behave as you have suggested, in other cases people want to disable the input field so that their end users are forced to use the picker and not manually typing.

@Antal1609
Copy link

Can confirm. We force users to use the picker by setting the input to readonly.

@vt-cloud
Copy link

I agree with @Antal1609 we also use the readonly attribute to force users to enter a date via the picker.

Ultimately the textbox is still readonly to the user, as it can only be updated via code.

A big advantage of this method is that the styling of the textbox remains unchanged for readonly elements in many UI frameworks so the user is still invited to click the box, whereas disabled elements look different.

@axunonb
Copy link

axunonb commented Aug 23, 2023

@Antal1609 comments on a use case, where the value of the the element should be editable (with the widget) and submitted to the server. But what if submitting is required, but editing not wanted. Currently, this is a pain to implement, if the date element is editable with the keyboard and the widget.
As per definition readonly is meant to make an element not mutable by the user (no matter how). So I think the default behavior should be that readonly target elements are not editable. Enable overriding readonly with a corresponding setting or parameter is still appreciated.

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

5 participants