mirror of
https://github.com/kevinveenbirkenbach/homepage.veen.world.git
synced 2026-05-14 09:15:32 +00:00
fix(navigation): unclip dropdowns and flip toward the side with more space
- Move <header> overflow:hidden into body.fullscreen scope and drop the implicit-vertical-clip overflow-x:auto from .navbar-nav so dropdown menus can escape the navbar. - Drive top-level dropdowns through bootstrap.Dropdown (popperConfig strategy:'fixed'), and add a chooseDirection() helper that toggles .dropup/.dropdown on the .nav-item based on space above vs below before each show. Split the navigation.css rules to position the menu with top:100% or bottom:100% accordingly. - Mark the dropdown toggle with data-bs-toggle="dropdown" in the template; cover that with a Jinja-rendered unit test and add Cypress specs for the header (opens downward) and footer (flips to .dropup) cases. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -111,17 +111,13 @@ div#navbarNavfooter li.nav-item {
|
||||
margin-right: 6px;
|
||||
}
|
||||
|
||||
/* Prevent nav items from wrapping to a second line */
|
||||
/* Prevent nav items from wrapping to a second line.
|
||||
overflow is intentionally NOT set here — overflow-x:auto would
|
||||
implicitly clip overflow-y too and hide dropdown menus that open
|
||||
below the navbar. */
|
||||
div#navbarNavheader .navbar-nav,
|
||||
div#navbarNavfooter .navbar-nav {
|
||||
flex-wrap: nowrap;
|
||||
overflow-x: auto;
|
||||
scrollbar-width: none; /* Firefox */
|
||||
}
|
||||
|
||||
div#navbarNavheader .navbar-nav::-webkit-scrollbar,
|
||||
div#navbarNavfooter .navbar-nav::-webkit-scrollbar {
|
||||
display: none; /* Chrome/Safari */
|
||||
}
|
||||
|
||||
main, footer, header, nav {
|
||||
@@ -197,7 +193,6 @@ iframe{
|
||||
/* 1. Make sure headers and footers can collapse */
|
||||
header,
|
||||
footer {
|
||||
overflow: hidden;
|
||||
/* choose a max-height that’s >= your tallest header/footer */
|
||||
max-height: 200px;
|
||||
padding: 1rem;
|
||||
@@ -206,9 +201,11 @@ footer {
|
||||
padding var(--anim-duration) ease-in-out;
|
||||
}
|
||||
|
||||
/* 2. In fullscreen mode, collapse them */
|
||||
/* 2. In fullscreen mode, collapse them. overflow: hidden is scoped here
|
||||
so dropdown menus can escape the header in normal mode. */
|
||||
body.fullscreen header,
|
||||
body.fullscreen footer {
|
||||
overflow: hidden;
|
||||
max-height: 0;
|
||||
padding-top: 0;
|
||||
padding-bottom: 0;
|
||||
|
||||
Reference in New Issue
Block a user