Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
fix(menu): scroll a menu's rows up to its edge instead of cutting them off inside it
Elian Dorana97356882188
diff --git a/apps/client/src/widgets/react/Dropdown.css b/apps/client/src/widgets/react/Dropdown.cssdeleted file mode 100644index 523427d5bf..0000000000--- a/apps/client/src/widgets/react/Dropdown.css+++ /dev/null@@ -1,18 +0,0 @@-/* A scrollable panel's frame does not scroll; its content does, in the height it is capped to. */-.dropdown-menu:has(> .tn-panel-scroll) {- display: flex;- flex-direction: column;-}--.tn-panel-scroll {- /* Matches the panel's own padding in the theme's `.dropdown-menu:not(.static)` rule. */- --tn-panel-padding: var(--padding, var(--menu-padding-size));- flex: 1 1 auto;- min-height: 0;- /* Spans the panel's padding, so the content scrolls up to its edge rather than being cut off- inside it. */- margin: calc(0px - var(--tn-panel-padding));- padding: var(--tn-panel-padding);- border-radius: inherit;- overflow-y: auto;-}diff --git a/apps/client/src/widgets/react/Dropdown.tsx b/apps/client/src/widgets/react/Dropdown.tsxindex fac64dbded..4835b822a4 100644--- a/apps/client/src/widgets/react/Dropdown.tsx+++ b/apps/client/src/widgets/react/Dropdown.tsx@@ -1,7 +1,5 @@import type { Placement } from "@floating-ui/dom";import type { Dropdown as BootstrapDropdown, Tooltip } from "bootstrap";-import "./Dropdown.css";-import clsx from "clsx";import { ComponentChildren, HTMLAttributes } from "preact";import { CSSProperties, HTMLProps } from "preact/compat";diff --git a/apps/client/src/widgets/react/Menu.css b/apps/client/src/widgets/react/Menu.cssindex 23bb0333dd..2ab3210afd 100644--- a/apps/client/src/widgets/react/Menu.css+++ b/apps/client/src/widgets/react/Menu.css@@ -7,18 +7,9 @@visibility: hidden;}-/*- * The top level does not scroll, so the blur the theme puts on its `::before` covers it whatever- * its rows scroll to. Its rows scroll inside, in the height `placeFloating()` caps it to.- */-.dropdown-menu.tn-menu:has(> .tn-menu-scroll) {- display: flex;- flex-direction: column;-}-/** The lists that hold the rows take none of the browser's list styling. `:where()` keeps this- * below `.tn-menu-scroll`, whose inline padding it must not undo.+ * below `.tn-menu-scroll`, whose padding it must not undo.*/:where(.tn-menu) menu {margin: 0;@@ -26,21 +17,6 @@list-style: none;}-.tn-menu-scroll {- /* Matches the menu's own padding in the theme's `.dropdown-menu:not(.static)` rule. */- --tn-menu-inline-padding: var(--padding, var(--menu-padding-size));- flex: 1 1 auto;- min-height: 0;- /*- * Spans the menu's inline padding, so the separator and header lines, which the theme draws- * that far past a row, stay inside the scroller instead of scrolling it sideways. Without the- * theme's variables both fall back to 0, as that theme's menu has no inline padding.- */- margin-inline: calc(0px - var(--tn-menu-inline-padding));- padding-inline: var(--tn-menu-inline-padding);- overflow-y: auto;-}-/* A submenu is placed by `placeFloating()`, not beside a parent it is nested in. */.dropdown-submenu > .dropdown-menu.tn-menu {inset: 0 auto auto 0;diff --git a/apps/client/src/widgets/react/Popup.css b/apps/client/src/widgets/react/Popup.cssindex 725e573510..40772d6743 100644--- a/apps/client/src/widgets/react/Popup.css+++ b/apps/client/src/widgets/react/Popup.css@@ -11,3 +11,31 @@ body .tn-popup {z-index: 1200;visibility: hidden;}++/*+ * A menu's or a scrollable panel's frame does not scroll, so the blur the theme puts on its+ * `::before` covers it whatever its content scrolls to. The content scrolls inside, in the height+ * `placeFloating()` caps the frame to.+ */+.dropdown-menu:has(> :is(.tn-menu-scroll, .tn-panel-scroll)) {+ display: flex;+ flex-direction: column;+}++.tn-menu-scroll,+.tn-panel-scroll {+ /* Matches the frame's own padding in the theme's `.dropdown-menu:not(.static)` rule. */+ --tn-popup-padding: var(--padding, var(--menu-padding-size));+ flex: 1 1 auto;+ min-height: 0;+ /*+ * Spans the frame's padding, so the content scrolls up to its edge instead of being cut off+ * inside it, and the separator and header lines, which the theme draws that far past a row,+ * stay inside the scroller instead of scrolling it sideways. Without the theme's variables+ * both fall back to 0, as that theme's menu has no padding.+ */+ margin: calc(0px - var(--tn-popup-padding));+ padding: var(--tn-popup-padding);+ border-radius: inherit;+ overflow-y: auto;+}