question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Read only text input

See original GitHub issue

ref: https://github.com/carbon-design-system/carbon/issues/2177 by @shixiedesign

A read only variant of Text input is suggested here: https://github.com/carbon-design-system/carbon-contribution/issues/13#issue-421692303

The “Disabled” option is not viable, as the label and entered data is not accessible. Proposal is to simply remove the line at the base of the “Filled” version of the component, so that it closely matches with the Disabled component, but passes accessibility.

Overview of component (updated May 13)

  • Read-only variant will be keeping underline and dropping the background of the field. We need the underline for low-vision users to recognize this as a text field. Also loosing the underline makes the element a button-style, which would be confusing.
  • Not moving the text position after all. Keeping text 16px away from left of border helps with preserving the form structure.
  • Regular text cursor and allows text selecting
  • Add not-editable icon, icon in PR https://github.com/carbon-design-system/carbon/pull/2710
  • Optional tooltip when hovering not-editable icon, to provide reason for the field being read-only
  • Overflow text in the field will show in tooltip on hover
  • Should be considered a state, possible readonly attribute
  • Follow the standard readonly attribute: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-readonly

Design spec (updated May 13)

image

In context explorations:

image image

Finalized design spec. Ready for dev 🤖 updated May 23

Read-only 1

Light variant spec

Only difference from default is changing field background to $field-01 so it is the same as background color.

Read-only 2

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:16 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
asudohcommented, Oct 24, 2019

@aagonzales Sorry I may not have been clear enough - It’s #4015. The latest spec for read-only text input requests for a tooltip (presumably for overflow text). Definition tooltip is the closest, but definition tooltip (technically) cannot be activated by focus on <input>. #4015 is for supporting such use case in definition tooltip.

1reaction
kaylarakowercommented, Jun 19, 2019

@shixiedesign @emyarod Another proposal to consider (I created this issue prior to seeing @shixiedesign 's, so just some food for thought). The design was created for a slightly use case as none of the fields would be editable.

https://github.com/carbon-design-system/carbon-contribution/issues/17

Read more comments on GitHub >

github_iconTop Results From Across the Web

HTML input readonly Attribute - W3Schools
The readonly attribute is a boolean attribute. When present, it specifies that an input field is read-only. A read-only input field cannot be...
Read more >
HTML attribute: readonly - HTML: HyperText Markup Language
The Boolean readonly attribute, when present, makes the element not mutable, meaning the user can not edit the control. Try it. HTML Demo: ......
Read more >
HTML5 Forms: Readonly Type Attribute - Wufoo
The readonly attribute makes a form control non-editable (or “read only”). A read-only field can't be modified, but, unlike disabled , you can...
Read more >
HTML | input readonly Attribute - GeeksforGeeks
The readonly attribute of <input> element in HTML is used to specify that the input field is read-only. If an input is readonly,...
Read more >
Making a react-native TextInput readonly - Stack Overflow
I want to make a text input readonly in my RN application. I tried to set an editable prop but it did not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found