Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
navigation-3377317
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Issue forks
navigation-3377317
Commits
65d97805
Commit
65d97805
authored
1 year ago
by
utkarsh_33
Committed by
Lauri Timmanee
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3375854
: Scroll the sidebar to the active item when loading the page
parent
abd63a6b
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
js/sidebar.js
+6
-1
6 additions, 1 deletion
js/sidebar.js
with
6 additions
and
1 deletion
js/sidebar.js
+
6
−
1
View file @
65d97805
...
...
@@ -124,6 +124,11 @@ document.addEventListener("DOMContentLoaded", function () {
linkElements
=
linkElements
.
parentElement
;
}
expandSidebar
();
const
expandedTray
=
document
.
querySelector
(
'
.menu-item.menu-item--expanded
'
);
if
(
expandedTray
)
{
const
sidebar
=
document
.
getElementById
(
'
navigation-sidebar
'
);
const
trayOffset
=
expandedTray
.
getBoundingClientRect
().
top
-
sidebar
.
getBoundingClientRect
().
top
;
sidebar
.
scrollTo
({
top
:
trayOffset
,
behavior
:
"
smooth
"
});
}
}
});
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