1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-19 22:03:19 +03:00

Layout: Improved sidebar sizing, and dropdown consideration

- Updated tri-layout sidebars to have less padding and to avoid cutting
  off content when in single-sidebar mode.
- Updated dropdown handling to consider the parent scroll container when
  deciding to drop upwards, to help prevent cut-off.
This commit is contained in:
Dan Brown
2025-06-30 13:19:45 +01:00
parent dfeca246a0
commit 6045aff33a
3 changed files with 25 additions and 3 deletions

View File

@ -1,4 +1,4 @@
import {onSelect} from '../services/dom.ts';
import {findClosestScrollContainer, onSelect} from '../services/dom.ts';
import {KeyboardNavigationHandler} from '../services/keyboard-navigation.ts';
import {Component} from './component';
@ -33,7 +33,8 @@ export class Dropdown extends Component {
const menuOriginalRect = this.menu.getBoundingClientRect();
let heightOffset = 0;
const toggleHeight = this.toggle.getBoundingClientRect().height;
const dropUpwards = menuOriginalRect.bottom > window.innerHeight;
const containerBounds = findClosestScrollContainer(this.menu).getBoundingClientRect();
const dropUpwards = menuOriginalRect.bottom > containerBounds.bottom;
const containerRect = this.container.getBoundingClientRect();
// If enabled, Move to body to prevent being trapped within scrollable sections