Skip to content

[BUG] Inner Label in OFF State appears in ON State when ON State is Empty #7617

@aworld1

Description

@aworld1

Environment

  • Package version(s): 6.3.2
  • Operating System: MacOS
  • Browser name and version: Island, latest

Code Sandbox

Testable by adding simply:

<Switch
    {...switchProps}
    labelElement={"Bug Test: Only ON label"}
    innerLabelChecked="on"
    innerLabel=""
/>
<Switch
    {...switchProps}
    labelElement={"Bug Test: Only OFF label"}
    innerLabelChecked=""
    innerLabel="off"
/>

Steps to reproduce

  1. Give a switch an off inner label
  2. Leave its on inner label blank
  3. Turn it on and off, notice the label is present for both
  4. Do the reverse (label for on only) and notice it's only present in the on state

Actual behavior

Label is present in both on and off state, even when just specified in off state

Expected behavior

Should only appear for specified state

Proof of issue

Image Image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions