Skip to content

FOLLOW-UP: Bug — Tab-away closes autocomplete during keyboard selection #300

@adnaan

Description

@adnaan

Context

This follow-up task was identified during the review of PR #292.

Source PR: #292
Suggested by: @claude[bot]

Task Description

lvt-el:removeClass:on:focusout="open" fires whenever focus leaves any element inside the component — including when focus moves from the input to a suggestion item via keyboard Tab. This incorrectly closes the dropdown mid-selection.

The old Blur() approach handled this implicitly via server-side logic.

Fix: Use onfocusout with a relatedTarget check to avoid closing when focus moves within the component:

onfocusout="if(!this.closest('[data-autocomplete]').contains(event.relatedTarget))this.closest('[data-autocomplete]').classList.remove('open')"

Or add a small delay before hiding to allow focus to settle.


This issue was automatically created from PR #292 review comments.

Metadata

Metadata

Assignees

No one assigned

    Labels

    follow-upFollow-up task from PR reviewfrom-reviewIssue originated from PR review

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions