Skip to content

scale-dropdown-select: readonly prop has no effect #2544

Description

@popadicbranislav

Scale Version

@telekom/scale-components@3.0.0-beta.160. The relevant code on main looks
unchanged, so I do not think 3.0.0-beta.161 fixes it either.

Framework and version

Vue 3.5.33, using the web components directly via defineCustomElements from
@telekom/scale-components/loader — no auto-generated wrapper package. The
behaviour is in the component itself, so the framework should not matter.

Current Behavior

scale-dropdown-select accepts a readonly prop — it is in the shipped type
declarations — but setting it does nothing. The dropdown still opens on click
and via the keyboard, and the value can still be changed. There is also no
visual difference between a read-only and an editable field.

disabled works correctly; only readonly is affected.

From reading the source, readonly looks unimplemented rather than broken:

  • setOpen() early-returns on this.disabled only, so readonly never
    prevents the listbox from opening.
  • The combobox trigger sets tabindex: this.disabled ? '-1' : '0', so a
    read-only field stays in the tab order.
  • getBasePartMap() emits a readonly part token, but dropdown-select.css
    has no rule matching it, so there is no read-only styling.
  • handleClearClick() is the only handler that checks readonly, and it is
    only reachable when allow-clear is set.

Expected Behavior

A read-only dropdown should not open and its value should not be changeable,
consistent with readonly on scale-text-field. Ideally it would also be
visually distinguishable from an editable field.

Code Reproduction

https://codesandbox.io/p/devbox/scale-components-plain-html-template-forked-wsz56r

No framework needed — this is enough:

<scale-dropdown-select readonly label="City" value="berlin">
  <scale-dropdown-select-item value="berlin">Berlin</scale-dropdown-select-item>
  <scale-dropdown-select-item value="bonn">Bonn</scale-dropdown-select-item>
</scale-dropdown-select>
  1. Click the field — the listbox opens.
  2. Pick "Bonn" — the value changes, despite readonly.
  3. Press Tab — the field is still in the tab order, and
    Enter/ArrowDown opens it too.

Swapping readonly for disabled behaves as expected, which is the contrast
that makes this look like an oversight.

Desktop (please complete the following information):

  • OS: Windows 11
  • Browser: Chrome
  • Version: -

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions