Skip to content

[EuiSuperSelect] Ignores readOnly prop #3510

Closed

Description

@mwswindle

I'm developing a plugin on Kibana v7.7.0 tag, which is using elastic/eui v21.0.1.

I'm using the EuiSuperSelect component, which has a readOnly prop. If I set this prop to true, I can see the styling of the component change, removing the shadows, but I'm still able to change the value.

I have several other EUI components (such as EuiFieldText) that use the same readOnlyState variable, that all behave as expected.

<EuiSuperSelect
  readOnly={readOnlyState} // <-- Changes style, but not function
  valueOfSelected={itemId}
  onChange={setItemId} // <-- This is called regardless of *readOnlyState*
  options={itemOptions}
/>

image

Activity

  1. cchaos commented on May 26, 2020

    @cchaos
    Contributor

    Hi @mwswindle! I noticed this too pretty recently, thank you for making an issue.

    The problem is that <select> HTML elements that this component is mimicking doesn't actually support readonly so it's actually more of a mistake to both

    a. support the prop
    b. apply the styles for it

    It's more appropriate to use the disabled prop. Though it does beg the question whether or not we should "fake" a readonly state for our own components.

  2. changed the title [-]EuiSuperSelect ignoring readOnly prop[/-] [+][EuiSuperSelect] Ignores `readOnly` prop[/+] on Sep 20, 2020
  3. github-actions commented on Mar 20, 2021

    @github-actions

    👋 Hey there. This issue hasn't had any activity for 180 days. We'll automatically close it if that trend continues for another week. If you feel this issue is still valid and needs attention please let us know with a comment.

  4. added
    stale-issue
    on Mar 20, 2021
  5. removed
    stale-issue
    on Mar 20, 2021
  6. github-actions commented on Sep 17, 2021

    @github-actions

    👋 Hey there. This issue hasn't had any activity for 180 days. We'll automatically close it if that trend continues for another week. If you feel this issue is still valid and needs attention please let us know with a comment.

  7. added
    stale-issue
    on Sep 17, 2021
  8. added and removed
    stale-issue
    on Sep 17, 2021
  9. cchaos commented on Sep 17, 2021

    @cchaos
    Contributor

    I think we should go ahead and support the readOnly prop in functionality as well as look. This means:

    • Removing any interaction behavior when the prop is true
    • Removing the down arrow when the prop is true.
  10. self-assigned this
    on Mar 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions