Version: @bcc-code/component-library-vue 1.4.36
We show forms to users who may view but not edit them. There is no single way to render such a form as read-only with the library today, so every app works around it differently.
Everything below was reproduced in a bare Vite + Vue app that only does app.use(BccComponentLibrary) and imports @bcc-code/component-library-vue/style.css. There is no Tailwind, no other UI library and no app CSS.
What we ran into
BccSelect and BccInputChips accept readonly but ignore it. They re-export PrimeVue Select and InputChips, which have no such prop, so readonly lands on the root element as a plain attribute. A readonly BccSelect still opens its dropdown, and a readonly BccInputChips still adds a tag on Enter and still shows each chip's remove icon. BccInput, BccTextarea and BccCheckbox do support readonly, so a mixed form ends up part readonly and part disabled.
- Readonly fields look editable. Readonly
BccInput, BccTextarea and BccSelect compute to the same background (#fff) and text colour (rgb(41, 42, 46)) as editable ones, so users only find out when they try to type.
- Disabled fields fade the value to about 2:1 contrast. Disabled
BccInput, BccTextarea and the BccSelect label use --p-inputtext-disabled-color (rgba(8, 15, 33, .29)) on --p-inputtext-disabled-background (rgba(5, 21, 36, .06)), which is 1.93:1. That's fine for a control that really is unavailable (WCAG exempts inactive components), but it makes disabled unusable as a stand-in for read-only, where people need to read the value.
- Disabled
BccInputChips is styled differently from the other disabled fields.
- Its background is
--p-inputchips-disabled-background (#dddee1), so it renders darker than the inputs next to it.
- It fades through
opacity: 0.6 on the whole component, about 3.3:1 for the chip text, instead of the disabled text colour.
- It keeps showing each chip's remove icon.
- A readonly
BccCheckbox still fires a native change on click. The model stays unchanged, but the native input flips to checked, and a form-level @change listener, such as unsaved-changes tracking, still sees an edit.
Suggestion
- Add a real
readonly to BccSelect and BccInputChips. Readonly should mean: focusable, value selectable, no dropdown or editing, chip remove icons hidden.
- Give readonly fields a visual style of their own in the theme, e.g. a muted background with full-contrast text, used the same way across
BccInput, BccTextarea, BccSelect, BccInputChips and BccCheckbox.
- Style disabled
InputChips the same way as the other disabled inputs (same background token, same text treatment) and hide the chip remove icon.
- Stop the native
change event on a readonly BccCheckbox (e.g. preventDefault on click), so the native state matches the model.
Our workaround for now is a scoped style that gives readonly and disabled fields the same muted background and full-contrast text, and hides the chip remove icons. We'd rather delete it than keep it.
Version:
@bcc-code/component-library-vue1.4.36We show forms to users who may view but not edit them. There is no single way to render such a form as read-only with the library today, so every app works around it differently.
Everything below was reproduced in a bare Vite + Vue app that only does
app.use(BccComponentLibrary)and imports@bcc-code/component-library-vue/style.css. There is no Tailwind, no other UI library and no app CSS.What we ran into
BccSelectandBccInputChipsacceptreadonlybut ignore it. They re-export PrimeVueSelectandInputChips, which have no such prop, soreadonlylands on the root element as a plain attribute. A readonlyBccSelectstill opens its dropdown, and a readonlyBccInputChipsstill adds a tag on Enter and still shows each chip's remove icon.BccInput,BccTextareaandBccCheckboxdo supportreadonly, so a mixed form ends up partreadonlyand partdisabled.BccInput,BccTextareaandBccSelectcompute to the same background (#fff) and text colour (rgb(41, 42, 46)) as editable ones, so users only find out when they try to type.BccInput,BccTextareaand theBccSelectlabel use--p-inputtext-disabled-color(rgba(8, 15, 33, .29)) on--p-inputtext-disabled-background(rgba(5, 21, 36, .06)), which is 1.93:1. That's fine for a control that really is unavailable (WCAG exempts inactive components), but it makesdisabledunusable as a stand-in for read-only, where people need to read the value.BccInputChipsis styled differently from the other disabled fields.--p-inputchips-disabled-background(#dddee1), so it renders darker than the inputs next to it.opacity: 0.6on the whole component, about 3.3:1 for the chip text, instead of the disabled text colour.BccCheckboxstill fires a nativechangeon click. The model stays unchanged, but the native input flips tochecked, and a form-level@changelistener, such as unsaved-changes tracking, still sees an edit.Suggestion
readonlytoBccSelectandBccInputChips. Readonly should mean: focusable, value selectable, no dropdown or editing, chip remove icons hidden.BccInput,BccTextarea,BccSelect,BccInputChipsandBccCheckbox.InputChipsthe same way as the other disabled inputs (same background token, same text treatment) and hide the chip remove icon.changeevent on a readonlyBccCheckbox(e.g.preventDefaulton click), so the native state matches the model.Our workaround for now is a scoped style that gives readonly and disabled fields the same muted background and full-contrast text, and hides the chip remove icons. We'd rather delete it than keep it.