Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add option to disable pre-selects of first dropdown item in n-auto-complete #6797

Open
3 tasks done
lanyeeee opened this issue Mar 6, 2025 · 0 comments · May be fixed by #6798
Open
3 tasks done

add option to disable pre-selects of first dropdown item in n-auto-complete #6797

lanyeeee opened this issue Mar 6, 2025 · 0 comments · May be fixed by #6798
Labels
feature request New feature or request

Comments

@lanyeeee
Copy link

lanyeeee commented Mar 6, 2025

Clear and concise description of the problem

Currently, the n-auto-complete always pre-selects the first option in the dropdown list, which means pressing Enter will automatically select this option.

While this behavior is useful in many cases, there are scenarios where developers might want to disable this auto-pending behavior to give users more explicit control over their selections.

Suggested solution

In the n-auto-complete component, we can add a new boolean prop called auto-pending which defaults to true to maintain backward compatibility:

autoPending: {
  type: Boolean,
  default: true
}

Then we can pass this prop to the internal select menu component:

<NInternalSelectMenu
  // other props
  autoPending={this.autoPending}
  // other props
/>

This allows users to disable the automatic pre-selection of the first option by setting auto-pending="false" on the component:

<n-auto-complete
  v-model:value="value"
  :options="options"
  :auto-pending="false"
/>

Alternative

No response

Additional context

No response

Validations

  • Read the Contributing Guidelines.
  • Read the docs.
  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
@lanyeeee lanyeeee added the feature request New feature or request label Mar 6, 2025
@lanyeeee lanyeeee linked a pull request Mar 6, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant