Closed shixiedesign closed 1 year ago
awaiting specification.
i have a couple of questions for implementation:
read-only
/readOnly
?From my understanding the implementations should follow the standard readonly
attribute: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-readonly
Thanks everyone for the thoughts and discussion. I've updated the original issue description with spec, and summarized all the comments here. This issue is now ready for development!
Moving issue back to visual design
stage to figure out the following potential changes:
not-allowed
cursor. Waiting on feedback. should we afford for any kind of status messages/icon/tooltip/etc as part of the pattern for readonly
input fields? (typically on forms, if i can't edit something, i want to know why and where i need to go to be able to do so).
i can see the case for product teams being responsible for this, but if we have a particular suggested pattern for how to handle that hinting, we could build it in. (e.g. a lock icon in in the field that can launch a tooltip)
Lock icon is a good idea @lovemecomputer ! Lemme try it out...
Thoughts everyone?
@shixiedesign yeah that makes sense! especially nice that it fits in the spot we already have for show/hide password :)
Talking to Anna and Lauren, the lock icon has potential confusion with the idea of security. I tried making a not-editable icon too. See below...
Do you guys have more context on which is better? @JordanWSmith15 @werdnanoslen
Changes below include:
not-allowed
cursor. It's a bit too aggressive@shixiedesign I think the edit with the cross-out is better for my use cases. Locks might make the user think that they can click to unlock, or that there is somewhere they can go to unlock, which is not the use-case (in my product anyway).
Only difference from default is changing field background to $field-01
so it is the same as background color.
🎉
@carbon-design-system/design do we want to apply this to number inputs and textareas as well?
also, is there a light
version for this variant?
(@emyarod please tag @shixiedesign directly for questions like this.)
Yep there's always a light variant. I will provide spec in a minute. And yes to number input. I'd say no text area at the moment until we see a need arises. 👍
@shixiedesign I didn't want to get into it, as the text input is my immediate need, but numeric input becoming read-only is also a use case for me, including just about every other component for user input: Check box, date picker, radio button, slider and toggle (to name the most common). These could still be represented the same way though... a line with text shown as non-editable. You did this with "expiration date" in your in-context example, whith the date picker component. Seems to work well enough.
Team agreed to adding Read-only
state to
Slider and toggle should be following disabled
state in these situations, or a number input at read-only state. Waiting on text area component until need arises.
@shixiedesign for the number input and date picker, do we still want the tooltip with the input field value?
also is there a mockup for read-only mobile number input?
on a side note, this may depend on https://github.com/carbon-design-system/carbon/pull/2781 due to the tooltip usage for read only inputs
@emyarod Tooltip with input field value should only show up where there's an overflow of content. This should apply to both number, text, and date input.
The tooltip on Edit--off
icon should however be always available. On mobile devices, icon tooltip should trigger on tap (do we have that?)
Structurally, the spec should be similar to text input, where icon is 16px away from both edge of field and content of the field. See https://github.com/carbon-design-system/carbon/issues/2177#issuecomment-492047569
going to label this as an epic and track the read only versions of text input, date picker, and number input separately
We've marked this issue as stale because there hasn't been any activity for a couple of weeks. If there's no further activity on this issue in the next three days then we'll close it. You can keep the conversation going with just a short comment. Thanks for your contributions.
@shixiedesign This one is marked as stale, which is OK I guess, but has the read-only states for text entry or anything made it into the sketch kits or component demos?
Hi @JordanWSmith15
@shixiedesign is on vacay for the next week and a half so I'm trying to get up to speed on some of this stuff. So sorry for all the confusion!
According to our process ( @laurenmrice correct me if i'm wrong) our components don't go into the kit if they haven't been developed. I know the read only form has a design spec from shixie that's been passed off to dev and is here in this PR:
https://github.com/carbon-design-system/carbon/issues/3018
Apparently Shixie's already signed off on it, but @emyarod is waiting on a dev response for some code tweaks that were requested.
There's also number input and date picker read only versions but they haven't been built yet!
We've marked this issue as stale because there hasn't been any activity for a couple of weeks. If there's no further activity on this issue in the next three days then we'll close it. You can keep the conversation going with just a short comment. Thanks for your contributions.
not stale
We've marked this issue as stale because there hasn't been any activity for a couple of weeks. If there's no further activity on this issue in the next three days then we'll close it. You can keep the conversation going with just a short comment. Thanks for your contributions.
As there's been no activity since this issue was marked as stale, we are auto-closing it.
@shixiedesign Is there any progress on this, or should we re-open it?
We've marked this issue as stale because there hasn't been any activity for a couple of weeks. If there's no further activity on this issue in the next three days then we'll close it. You can keep the conversation going with just a short comment. Thanks for your contributions.
not stale
Just for a reference to https://github.com/carbon-design-system/carbon/issues/3018#issuecomment-544746261 - Discussion on tooltip usage (read-only with overflow text) is blocking it from making progress.
One idea, as I stated there, is going without such "overflow text" spec. @laurenmrice @aagonzales Is it something we can do?
+1 to this issue.
We have all sorts of user permissions in our product now, and would like to be able to show those users with viewer permissions the values of various fields without having to use disabled styling (and thereby making them hard to read).
One option would be we just design a read only version of every page which uses text elements instead of input fields, but replacing input fields with read-only versions would be much less work and would allow us to have the read only and editable versions of the pages match up.
Maybe I'm missing part of the point here, but so far the requirements listed and the design exploration seems to be:
"We want an editable field where edit is disabled for some reason (eg permissions). We want to make it clear it can sometimes be editable, but that time is not now and communicate why it isn't. We don't want to use the disabled state for this because the visual styling is too heavy"
Which to me, sounds like the purpose of the disabled state, and sounds like we should be taking a look at the visual design of the disabled states if we are essentially exploring what seems to be a 'softer' alternative rather than another state for achieving/communicating almost the same thing (you can't edit this) slightly differently?
The reason this struck me, is that in some of the exploration our teams are doing is that many resources are by default in a 'read only' state, irrespective of the users ability to edit because they are just taking a look at something, I don't want to mess with it, just know what it is. - Eg my machine is running, here are the specs I have listed for it. They then would hit an edit button to turn that page/container/single field into an edit state, where the inputs all live.
I mocked a quick example:
The 'date activated' is disabled in the first case (and I stole the no-edit icon/tooltip from here to see how that would work), because there is something stopping me from being able to edit it, even though its in an editable context. However, the whole right panel to me is 'read only' these things have been saved and are in a 'read only' state, unless you choose to enter/reenter an edit state.
Am I losing my mind or are these 2 different things?
some differences between disabled and read only inputs include: the value of a disabled input will not be submitted in an HTML form, and disabled inputs will also be unfocusable and unnavigable via keyboard. read only inputs will send their values in a form and also be focusable and keyboard navigable (just not editable)
I suppose conceptually there doesn't have to be any visual difference between an editable input and a read only input. They could be the same but editing is unavailable in a read only version.
For example this URL field in Typeform is not disabled, I can click into it, select the text etc. But I cannot edit it - it simply does nothing if I try to interact.. That's potentially an approach.
Luke shows another where he converts input fields into a similarly sized/shaped text component, although it's limited to text inputs/dropdown, and I don't quite see how it would be applied to radio buttons, checkboxes or other forms of input.
I would summarise the request as:
A point of view on how to represent settings which are not currently editable because they are in a read only state, in an easily legible format - i.e. without using disabled fields - which are extremely hard to read due to their styling.
Just stumbled across this when using readonly
prop with NumberInput
. From the examples I see in this issues and out in the wild (for example shared link on box) the visual design currently implemented does not seem to match the intention of this input. Rather, it looks almost identical to disabled
state due to its low contrast and the disallow-cursor. Is the visual design still being worked?
readonly:
disabled:
Checkbox Date picker Dropdown Number input Radio button Slider Text area Text input Toggle
Read-only textinput has the work done. Use it as a reference. Make sure the visuals line up.
@sstrubberg here's the pattern info: https://ibm.ent.box.com/notes/948323199814 and i'm attaching the Sketch spec doc here as well. Mike Eacker and myself will be your point people for it.
Carbon - Read-only input components - HIFI v01.06.sketch.zip
NOTE: You might be looking for aria-readonly and aria-disabled which come with none of the functionality of the readonly and disabled attributes (semantic only).
NOTE 2: Microsoft would appear to consider disabled and readonly harmful https://medium.com/@izzmo/anti-pattern-using-disabled-or-read-only-for-form-input-e2c24c669f5b
@lee-chase - for note 2, the problem we would run into if we used the author's recommendations is that all disabled states for carbon would be invalidated based on legibility alone. this was the original reasoning for attempting a new read-only state. the good news is that after working alongside michael gower from the a11y team for several months on this, we are in a safe place in how we are going about designing the new read-only state. i'm guessing the way it is coded will definitely need to keep aspects of the article you mentioned in check however.
@lee-chase
Microsoft would appear to consider disabled and readonly harmful
I don't think we should assume that someone writing a personal blog is speaking for MS. There are a few challengeable things said in the article (see its comments for examples) that support this skepticism.
There are some common use cases for read-only content (I'll leave @quarryboy to point to the research). An underlying challenge is: how do you convey visually that the content is not editable when there is no established convention for displaying a read-only state? The article suggests adding more textual context. That is certainly an approach, but there are obvious advantages to having the text reinforce visual cues.
There are also some common use cases for disabled content. An underlying challenge there is: how do you convey to users who cannot see disabled content (either well or entirely) the potential of further interaction that a sighted user can infer from seeing a disabled control? It's important to emphasize that disabling already non-interactive text (ie. stuff that is not part of an input or other control) neither makes sense, nor passes text contrast requirements (the exception is only for "part of an inactive user interface component").
That's not to say there are no dangers in creating non-navigable or non-editable inputs. I think the Carbon team has a pretty good handle on those as well. Like any newly introduced feature, prepare to iterate!
NOTE: You might be looking for aria-readonly and aria-disabled which come with none of the functionality of the readonly and disabled attributes (semantic only).
There is definitely some advantage to adding the aria attributes, such as where a screenreader may not get sufficient info from the construct about its read-only state. But putting aria-readonly on something and yet letting it be functionally editable obviously creates its own problems. Clearly, the functional state and aria semantic information need to align.
Hope that helps!
@lee-chase
Microsoft would appear to consider disabled and readonly harmful
I don't think we should assume that someone writing a personal blog is speaking for MS. There a few challengeable things said in the article (see its comments for a few) that support this skepticism.
There are some common use cases for read-only content (I'll leave @quarryboy to point to the research). An underlying challenge is: how do you convey visually that the content is not editable when there is no established convention for displaying a read-only state? The article suggests adding more textual context. That is certainly an approach, but there are obvious advantages to having the text reinforce visual cues.
There are also some common use cases for disabled content. An underlying challenge there is: how do you convey to users who cannot see disabled content (either well or entirely) the potential of further interaction that a sighted user can infer from seeing a disabled control? It's important to emphasize that disabling already non-interactive text (ie. stuff that is not part of an input or other control) neither makes sense, nor passes text contrast requirements (the exception is only for "part of an inactive user interface component").
That's not to say there are no dangers in creating non-navigable or non-editable inputs. I think the Carbon team has a pretty good handle on those as well. Like any newly introduced feature, prepare to iterate!
NOTE: You might be looking for aria-readonly and aria-disabled which come with none of the functionality of the readonly and disabled attributes (semantic only).
There is definitely some advantage to adding the aria attributes, such as where a screenreader may not get sufficient info from the construct about its read-only state. But putting aria-readonly on something and yet letting it be functionality editable obviously creates its own problems. Clearly, the functional state and aria semantic information need to align.
Hope that helps!
A fair point well explained @mbgower
@lee-chase - for note 2, the problem we would run into if we used the author's recommendations is that all disabled states for carbon would be invalidated based on legibility alone. this was the original reasoning for attempting a new read-only state. the good news is that after working alongside michael gower from the a11y team for several months on this, we are in a safe place in how we are going about designing the new read-only state. i'm guessing the way it is coded will definitely need to keep aspects of the article you mentioned in check however.
I do not have a Sketch license at the moment, so I cannot currently review the latest shared design. However, I have seen a PDF, which may be out of date, that shows an effect very similar to the "light" version of a number of form elements. While the "light" option does not appear in all form components here https://carbondesignsystem.com/components/search/usage/ and it is not functional in some places it does, it does appear as part of the implementation https://react.carbondesignsystem.com/?path=/story/components-textinput--playground&args=light:true appearing as a property on 16 components in @carbon/react v11.
@lee-chase very true. the new read-only designs do take that into consideration and also has supporting cursor states that give an additional hint to the user around what is and isn't mutable. one big difference between the light option and read-only is that the light option simply alters the background color to the next value step up (lighter or darker according to the theme - as it is not functionally intended to be seen on the same colored background as the form item), whereas the read-only component has no background color at all.
@lee-chase very true. the new read-only designs do take that into consideration and also has supporting cursor states that give an additional hint to the user around what is and isn't mutable. one big difference between the light option and read-only is that the light option simply alters the background color to the next value step up (lighter or darker according to the theme - as it is not functionally intended to be seen on the same colored background as the form item), whereas the read-only component has no background color at all.
I might be missing something, but from a visual point of view, I'm not sure I see a distinction between having no background and a background that matches the default background.
@lee-chase ah i see where the confusion is. this is a practical UX problem. the "light" background is not intended to match the default background. the intended use of the "light" setting is an alternate setting for when the form item is on a background that is not the default.
meaning: if the white theme is used, then a gray10 background will be applied to the component by default. however, there are times where the component is placed on a gray10 background (rather than white) and contrast is still required to differentiate the background color of the component from its surroundings. the alternate "light" version will instead have a white background to create the appropriate contrast.
does that make sense?
Makes sense @quarryboy, although I suspect as a result that 'light' will have been misused in places.
@lee-chase i feel like we could’ve put money on the line. 😉 It’s almost a guarantee that bit has been misused!
A read only variant of Text input is suggested here: https://github.com/carbon-design-system/carbon-contribution/issues/13#issue-421692303
Overview of component (updated May 13)
not-editable
icon, icon in PR https://github.com/carbon-design-system/carbon/pull/2710not-editable
icon, to provide reason for the field being read-onlyreadonly
attributeDesign spec (updated May 13)
In context explorations: