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

Added read only / disabled flag to some components #84

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ViRuSTriNiTy
Copy link

see pkp/pkp-lib#5705

  • FieldAutosuggest, FieldText, FieldTextarea, added read only flag
  • FieldSelect, added disabled flag

  - FieldAutosuggest, FieldText, FieldTextarea, added read only flag
  - FieldSelect, added disabled flag
Copy link
Contributor

@NateWr NateWr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ViRuSTriNiTy! I think we need to make this a consistent prop across all of our fields, rather than adding it to just a few, and then document the prop as well. This entails the following:

  1. Add isReadonly to the props for FieldBase, so that every component that extends that one will be able to use the property.
  2. When defining the property, provide a default like this:
isReadonly: {
  type: Boolean,
  default() {
    return false;
  }
}
  1. Make sure that every field makes use of the property where appropriate, except for case like FieldHTML which doesn't input a value anyway.

@NateWr
Copy link
Contributor

NateWr commented Apr 6, 2020

Also, I'd like to see us standardize on isDisabled and isReadonly. They can have the same CSS styles applied to them, but apply the different disabled and readonly HTML attributes. If I recall correctly, the readonly attribute allows someone to interact with a field (like select text) but not change it, whereas the disabled attribute prevents someone from selecting text at all.

@asmecher
Copy link
Member

asmecher commented Apr 6, 2020

(One important distinction between disabled and readonly is the user's ability to scroll through long content to read it. That's not possible with a disabled field. So in cases like a metadata form that can't currently be edited but is still viewable/readable, readonly is a less frustrating user experience than disabled.)

Base automatically changed from master to main February 18, 2021 01:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants