Skip to content

When option matches placeholder, .chosen-default should not be added #2870

Open
@silverwind

Description

@silverwind

Steps to reproduce

  1. Open https://jsfiddle.net/silverwind/puqf4gs2/4/
  2. Select the 'placeholder' option

Expected behavior

The text in the select box should not be rendered like the placeholder, e.g. the chosen-default class should not be added, so it is possible to visually distinguish between a select element that has a option set vs. one that hasn't.

Actual behavior

The chosen-default class is added and with it, it's almost impossible to see if a item is selected (except the 'x' icon).

Environment

  • Chosen Version: 1.8.2
  • jQuery or Prototype Version: 3.2.1
  • Browser and Version: any
  • OS and Version: any

Additional information

I think the issue stems from this line, which does not distinguish between placeholder text and option text when deciding whether to add the chosen-default class:

if text is @default_text

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions