-
Notifications
You must be signed in to change notification settings - Fork 83
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
Read-only Field component #7962
Comments
I was playing around with this proposal to see if I understood how the component should behave in terms of accessibility. So, I came up with this prototype (https://codepen.io/diegocardoso/pen/BaXpyWZ). What I could see is that if read-only-sr.mp4I used |
Ah, indeed, I added that "with aria-labelledby reference to label" to the wrong "node" in the DOM proposal, it should be on the |
Even in that case, if the |
Ah, I hadn't expected that. I would have expected the label and the span to be "concatenated" in the announcement. Good catch! Then our options are probably
|
I also just now realized that using a non-input element as a "permanently read-only" field in a form (amongst normal editable fields) might not work well with NVDA and JAWS, since those usually switch to "forms mode" when they encounter an input, and in that mode they generally skip any non-field content until the user either reaches the end of the form or exits forms mode manually, which means that these "permanently readonly fields" would be skipped. If that is the case, these would not be a viable solution for use in forms where some fields are editable. That does still leave at least two other use cases:
For standalone label+value pairs, a dedicated component might be overkill, so we could look into extending the use cases for #7958 to cover that as well. Entirely read-only forms would probably make the most sense as DefinitionLists, so that could push us towards something like a ReadOnlyFormLayout, or a mode in FormLayout for rendering it as such (although that would also require a new type of API for defining the contents of the form that goes beyond adding specific field components to it). The value in having a dedicated non-input-based read-only rendering for read-only values is twofold:
Another possible solution, that would serve that last point, could be a feature in the input field components to render their visible value as a wrapping text element (hidden from screen readers), while keeping the (visually hidden) available for screen readers. |
A component for non-editable key-value pairs consisting of a label and a value, for use e.g. in read-only forms.
Labels above:
(This should work nicely out of the box in FormLayout, and align appropriately with input fields)
Labels aside:
(note: labels-aside mode should be considered together with labels-aside support in input fields)
Semantics
Could be as simple as
Or we could consider using
<data>
element for the value, and have the possibility to provide a machine-readable value in addition to the rendered value, possibly also switching that to a<time>
element for datetime values.Open questions
Is
ReadOnlyField
/vaadin-read-only-field
a good name?Could consider having a secondary text / slot, somewhat similar to the helper-text below input fields, e.g. for use cases such as this
The text was updated successfully, but these errors were encountered: