diff --git a/ui/shared/context_menu.js b/ui/shared/context_menu.js
index af3a844..d0e7872 100644
--- a/ui/shared/context_menu.js
+++ b/ui/shared/context_menu.js
@@ -131,17 +131,17 @@ export class ContextMenu extends MenuBase {
>
${
- item.icon
- ? html``
- : ""
- }
+ item.icon
+ ? html``
+ : ""
+ }
${item.label}
${
- item.checked
- ? html``
- : ""
- }
+ item.checked
+ ? html``
+ : ""
+ }
`,
)}
diff --git a/ui/system/color_picker.css b/ui/system/color_picker.css
index 4c62fa4..fdaee60 100644
--- a/ui/system/color_picker.css
+++ b/ui/system/color_picker.css
@@ -2,12 +2,9 @@
:host {
display: none;
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- z-index: var(--z-modal);
+ position: fixed;
+ inset: 0;
+ z-index: var(--z-modal, 40);
}
:host([open]) {
@@ -15,21 +12,20 @@
}
.backdrop {
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
+ position: fixed;
+ inset: 0;
background: var(--color-backdrop);
}
.picker {
- position: absolute;
+ position: fixed;
background: var(--bg-surface);
border-radius: var(--radius-lg);
box-shadow: 0 8px 32px var(--color-shadow);
padding: var(--spacing-2xl);
min-width: 280px;
+ max-height: calc(100vh - 16px);
+ overflow-y: auto;
font-family: var(--font-family-base);
font-size: var(--font-size-base);
}
diff --git a/ui/system/color_picker.js b/ui/system/color_picker.js
index 526235c..8f4e460 100644
--- a/ui/system/color_picker.js
+++ b/ui/system/color_picker.js
@@ -63,6 +63,21 @@ export class ColorPicker extends LitElement {
if (changedProperties.has("currentColor") && this.currentColor) {
this.parseInitialColor();
}
+ if (this.open) this._clamp();
+ }
+
+ /** Keep the picker fully onscreen (the menu does the same thing). */
+ _clamp() {
+ const picker = this.renderRoot.querySelector(".picker");
+ if (!picker) return;
+ picker.style.left = `${Math.max(
+ 8,
+ Math.min(this.x, window.innerWidth - picker.offsetWidth - 8),
+ )}px`;
+ picker.style.top = `${Math.max(
+ 8,
+ Math.min(this.y, window.innerHeight - picker.offsetHeight - 8),
+ )}px`;
}
disconnectedCallback() {
diff --git a/ui/system/desktop/index.html b/ui/system/desktop/index.html
index f4cdcae..35621f6 100644
--- a/ui/system/desktop/index.html
+++ b/ui/system/desktop/index.html
@@ -488,5 +488,6 @@
+