Skip to content

bug: last option is default in select element  #3301

@felix-ico

Description

@felix-ico

Prerequisites

Stencil Version

2.7.1

Current Behavior

When building a custom dropdown that accepts nested options, if no option has a selected attribute the last option is selected by default.

Expected Behavior

When no option has a selected attribute the first option should be selected.

Steps to Reproduce

Please have a look at https://codesandbox.io/s/codesandbox-stencil-forked-okptft (index.html and app-dropdown)

<app-dropdown>
  <option value="1">item 1</option>
  <option value="2">item 2</option>
  <option value="3">item 3</option>
  <option value="BAR">BAR</option>
</app-dropdown>

by default the dropdown shows "BAR" as selected, instead it should be "Item 1".

Code Reproduction URL

https://codesandbox.io/s/codesandbox-stencil-forked-okptft

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bug: ValidatedThis PR or Issue is verified to be a bug within Stencil

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions