fix(ui): keep mega menu open across hover gap
Quality / quality (windows-latest) (push) Waiting to run
Quality / quality (ubuntu-latest) (push) Failing after 9m51s

This commit is contained in:
2026-08-24 22:08:46 +05:30
parent d2d830e7e2
commit f5538ed621
5 changed files with 34 additions and 5 deletions
+22 -2
View File
@@ -44,6 +44,7 @@ component MegaMenu {
}
state visible = defaultOpen
state closeTimer = null
functions {
shared function columnList() {
@@ -59,15 +60,32 @@ component MegaMenu {
}
client function showPanel(sourceEvent) {
cancelScheduledHide()
visible = true
output.open({ sourceEvent: sourceEvent })
}
client function hidePanel(reason) {
cancelScheduledHide()
visible = false
output.close({ reason: reason })
}
client function cancelScheduledHide() {
if (closeTimer) {
window.clearTimeout(closeTimer)
closeTimer = null
}
}
client function scheduleHide() {
cancelScheduledHide()
closeTimer = window.setTimeout(function () {
closeTimer = null
hidePanel("pointer-leave")
}, 220)
}
client function togglePanel(sourceEvent) {
if (visible) {
hidePanel("toggle")
@@ -121,7 +139,8 @@ component MegaMenu {
data-full-width='{fullWidth ? "true" : "false"}'
data-column-count='{columnCount}'
@keydown='handleKeydown(event)'
@mouseleave='hidePanel("pointer-leave")'
@mouseenter='cancelScheduledHide()'
@mouseleave='scheduleHide()'
>
<button
type="button"
@@ -141,6 +160,7 @@ component MegaMenu {
data-wrn-anchored="true"
data-show="visible"
data-wrn-roving="both"
@mouseenter='cancelScheduledHide()'
>
<div class="wrn-mega__layout">
{#if railList().length > 0}
@@ -278,7 +298,7 @@ component MegaMenu {
left: 0;
right: 0;
bottom: 100%;
height: 0.6rem;
height: 0.85rem;
}
.wrn-mega__panel {