Skip to content

[Bug Report] <el-autocomplete> does not work with <el-form-item for="id"> #11636

@d--j

Description

@d--j

Element UI version

2.4.1

OS/Browsers version

All

Vue version

2.5.17-beta.0

Reproduction Link

https://jsfiddle.net/cj5ea28k/4/

Steps to reproduce

  <el-form label-width="200px">
    <el-form-item label="Click me 1" for="input1">
      <el-input id="input1"></el-input>
    </el-form-item>
    <el-form-item label="Click me 2" for="input2">
      <el-autocomplete id="input2" v-model="state1" :fetch-suggestions="querySearch" placeholder="Please Input"></el-autocomplete>
    </el-form-item>
  </el-form>

Click on the label "Click me 2".

What is Expected?

Clicking on the Label "Click me 2" should put the focus into the autocomplete field.

What is actually happening?

ElAutocomplete does not pass down the id prop to the ElInput (it generates one itself for the ElInput). Thus clicking on the label does nothing. You also have no reliable way to predict the generated id because it uses a random number.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions