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 Inputs: Checkbox Implementation

See original GitHub issue

Reference #12241

image image

Acceptance Criteria

  • Coded component in /package/react
  • Add a prop for read-only, add styles for said prop
  • Controls for each state in playground
  • Default story for easy copy and paste
  • RTL tests for the read-only class on the prop

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
aagonzalescommented, Oct 27, 2022

I personally don’t think we need read-only tokens. I think using a mix of regular and disabled color tokens in this context is acceptable. If the style ever diverges, we can make a specific one. Its only used in a few read-only components. We could make a whole suite of read-only tokens but I think that is overkill.

0reactions
tay1orjonescommented, Oct 25, 2022

@lee-chase I’ll jump in and try to answer some of these questions.

Personally prefer a control to a story, a disabled story would be odd.

We apply VRT to each story in the storybook. By having a dedicated story titled “readonly” we can ensure there are no visual regressions over time. I’m really either/or on this one though - we don’t usually have specific stories for other states like invalid. This could be a follow-on item later. For now it can be a control on the “playground” story imo

Perhaps also read only specific color tokens e.g. $border-readonly

My guess is no, we won’t add these as tokens. Adding tokens has lots of implications across the system. Ultimately this is a question for design though, @aagonzales what are your thoughts?

MDX file update?

Story files should import an .mdx file that corresponds to the “docs” tab in storybook. This .mdx file will need updated to include the readonly story as well as light docs on how/when to use the readonly prop/variant.

Q: A little concerned elsewhere we are using readOnly as opposed to the standard attribute readonly. Will this not cause confusion?

Yeah I think the standard attribute should be used here where possible, following convention of how we use other standard attributes like title. I think it should be listed as a prop and probably just have a proptype of bool.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can HTML checkboxes be set to readonly? - Stack Overflow
It's important to understand that READONLY merely prevents the user from changing the value of the field, not from interacting with the field....
Read more >
Semantic-UI Checkbox Read-only State - GeeksforGeeks
Example 1: This example demonstrates the checkbox read-only state using the read-only class . It displays both the true and false condition ...
Read more >
How to make checkbox readonly in javascript? - CodeProject
Hello, Friend try this JQuery $(document).ready(function(){ if($('#s:checked').length){ $('#sr').attr('readonly',true); // On Load, ...
Read more >
<input type="checkbox"> - HTML: HyperText Markup Language
In this example, we've got a name of subscribe , and a value of newsletter . When the form is submitted, the data...
Read more >
HTML input readonly Attribute - W3Schools
The readonly attribute can be set to keep a user from changing the value until some other conditions have been met (like selecting...
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