Set dropdownitem focus on mouseenter

Signed-off-by: Phillip Rak <rak.phillip@gmail.com>
This commit is contained in:
Phillip Rak 2025-01-30 10:31:13 -07:00
parent cea7caf275
commit 98d04e8c10
1 changed files with 11 additions and 0 deletions

View File

@ -69,6 +69,16 @@ const handleActivate = (e: KeyboardEvent) => {
}
};
/**
* Handles keydown events to focus the dropdown item.
* @param e - The Mouse event.
*/
const handleMouseEnter = (e: MouseEvent) => {
if (e?.target instanceof HTMLElement) {
e?.target?.focus();
}
};
</script>
<template>
@ -82,6 +92,7 @@ const handleActivate = (e: KeyboardEvent) => {
@click.stop="handleClick"
@keydown.enter.space="handleActivate"
@keydown.up.down.stop="handleKeydown"
@mouseenter="handleMouseEnter"
>
<slot name="default">
<!--Empty slot content-->