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

fix(VAutocomplete): reset selection index to -1 after deletion #20836

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -265,10 +265,8 @@ export const VAutocomplete = genericComponent<new <
) return select(model.value[0], false)

if (~selectionIndex.value) {
const originalSelectionIndex = selectionIndex.value
select(model.value[selectionIndex.value], false)

selectionIndex.value = originalSelectionIndex >= length - 1 ? (length - 2) : originalSelectionIndex
selectionIndex.value = -1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will I be unable to perform continuous deletions?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @babu-ch,

Yes, after this change, it will be unable to perform continuous deletions directly with a single backspace press. But can still delete by pressing backspace twice.

} else if (e.key === 'Backspace' && !search.value) {
selectionIndex.value = length - 1
}
Expand Down