Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
design-system-lib
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
julkiset-sivut
design-system-lib
Commits
b2b7a0e0
Commit
b2b7a0e0
authored
4 years ago
by
druid
Browse files
Options
Downloads
Patches
Plain Diff
set timeout to show panel to make hover less sensitive
parent
9128d43f
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/components/site-header/hy-desktop-menu-links/hy-desktop-menu-links.tsx
+21
-5
21 additions, 5 deletions
...te-header/hy-desktop-menu-links/hy-desktop-menu-links.tsx
with
21 additions
and
5 deletions
src/components/site-header/hy-desktop-menu-links/hy-desktop-menu-links.tsx
+
21
−
5
View file @
b2b7a0e0
...
...
@@ -42,6 +42,8 @@ export class HyDesktopMenuLinks {
private
_submenuLeftMargin
:
number
=
32
;
private
_headerBorderOffset
:
number
=
0
;
private
_hoverTimer
=
null
;
@
Watch
(
'
dataDesktopLinks
'
)
dataDesktopLinksWatcher
(
data
:
DesktopLinks
[]
|
string
)
{
this
.
_dataDesktopLinks
=
typeof
data
===
'
string
'
?
JSON
.
parse
(
data
)
:
data
;
...
...
@@ -116,6 +118,17 @@ export class HyDesktopMenuLinks {
let
rect
=
activeMenuItemSibling
.
getBoundingClientRect
();
this
.
showBackdropShadow
(
'
open
'
,
rect
.
bottom
);
/*
if (this.el.parentElement.classList.contains('hy-site-header--sticky-active')) {
console.log(rect.top + ' ' + rect.height + ' ' + rect.bottom) ;
this.showBackdropShadow('open', parseInt(headerHeight)+rect.height);
}
else {
console.log(rect.top + ' ' + rect.height + ' ' + rect.bottom) ;
this.showBackdropShadow('open', rect.bottom);
}
*/
// Position submenu block under the activated top menu item.
let
activeButtonRect
=
activeMenuItem
.
getBoundingClientRect
();
const
menuPanelLeftPosition
=
activeButtonRect
.
left
-
this
.
_submenuLeftMargin
;
...
...
@@ -182,13 +195,15 @@ export class HyDesktopMenuLinks {
}
handleDesktopMenuEnter
(
event
,
id
)
{
const
activeMenuItem
=
this
.
el
.
shadowRoot
.
querySelector
(
`.desktop-menu-link[link-id="
${
id
}
"]`
)
as
HTMLElement
;
this
.
_hoverTimer
=
setTimeout
(()
=>
{
const
activeMenuItem
=
this
.
el
.
shadowRoot
.
querySelector
(
`.desktop-menu-link[link-id="
${
id
}
"]`
)
as
HTMLElement
;
// Set focus to the button.
if
(
activeMenuItem
!==
null
)
activeMenuItem
.
focus
();
// Set focus to the button.
if
(
activeMenuItem
!==
null
)
activeMenuItem
.
focus
();
this
.
currenOpenMenuId
=
id
;
this
.
showPanel
(
id
);
this
.
currenOpenMenuId
=
id
;
this
.
showPanel
(
id
);
},
350
);
event
.
stopPropagation
();
}
...
...
@@ -201,6 +216,7 @@ export class HyDesktopMenuLinks {
if
(
leaveEvent
.
clientY
<
headerHeight
-
4
)
{
this
.
closePanel
();
clearTimeout
(
this
.
_hoverTimer
);
}
event
.
stopPropagation
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment