Skip to content

Commit 31ab0e9

Browse files
author
Alban Bailly
committed
better navigation scroll
1 parent 5e9f3a3 commit 31ab0e9

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

src/components/2_molecules/sidemenu.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ class SideMenu extends React.Component {
6060
activeEl && activeEl.parentNode.parentNode.parentNode.parentNode;
6161
activeEl && activeGroup.classList.add("active-group");
6262
}
63+
const activeGroup = document.getElementsByClassName("active-group")[0];
64+
65+
activeGroup &&
66+
activeGroup.scrollIntoView({
67+
block: "start"
68+
});
6369
});
6470

6571
hash &&

src/css/components/4_pages/api-page.css

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,8 @@
1111
}
1212

1313
.api-navigation {
14-
/* position: sticky; */
1514
z-index: 2;
1615
top: 2rem;
17-
overflow: hidden;
1816
}
1917

2018
.api-content-wrapper {
@@ -32,7 +30,8 @@
3230
visibility: hidden;
3331
}
3432

35-
.list-group {
33+
.list-group,
34+
.list-group ul {
3635
max-height: 0;
3736
visibility: hidden;
3837
line-height: 1;
@@ -41,7 +40,13 @@
4140
.active-group .list-group {
4241
max-height: 100%;
4342
visibility: visible;
44-
@apply mt-2 mb-4 ml-4;
43+
border-left: 1px solid #ddd;
44+
@apply mt-2 mb-4 ml-2 pl-2;
45+
}
46+
47+
.active-group .list-group ul {
48+
max-height: 100%;
49+
visibility: visible;
4550
}
4651

4752
.active-group .list-group li {

0 commit comments

Comments
 (0)