fix: stabilize popover positioning and prevent viewport overflow
- Switch popover from position:absolute to position:fixed to avoid scroll-offset math and simplify viewport clamping. - Add max-height + overflow-y:auto so the popover scrolls internally instead of overflowing the viewport. - Remove the reposition call after picker opens — this was causing the popover to flash and jump when the picker changed its height. - Improve edge clamping: if neither above nor below fits, clamp to viewport bottom rather than flipping unpredictably. - Remove the CSS arrow (::before) which was mispositioned when the popover appeared above the badge or near edges. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -86,14 +86,16 @@ html.rt-enabled .thing.link .flat-list li:has(> .comments) {
|
||||
|
||||
/* --- Color popover --- */
|
||||
.rt-color-popover {
|
||||
position: absolute;
|
||||
position: fixed;
|
||||
z-index: 10000;
|
||||
background: #fff;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 6px;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
|
||||
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
|
||||
padding: 12px;
|
||||
width: 260px;
|
||||
max-height: calc(100vh - 20px);
|
||||
overflow-y: auto;
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
||||
font-size: 13px;
|
||||
color: #1a1a1a;
|
||||
@@ -104,20 +106,6 @@ html.rt-enabled .thing.link .flat-list li:has(> .comments) {
|
||||
display: block;
|
||||
}
|
||||
|
||||
/* Popover arrow */
|
||||
.rt-color-popover::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: -6px;
|
||||
left: 16px;
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
background: #fff;
|
||||
border-left: 1px solid #ccc;
|
||||
border-top: 1px solid #ccc;
|
||||
transform: rotate(45deg);
|
||||
}
|
||||
|
||||
.rt-popover-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
@@ -275,12 +263,6 @@ html.rt-enabled .thing.link .flat-list li:has(> .comments) {
|
||||
color: #e0e0e0;
|
||||
}
|
||||
|
||||
.rt-color-popover.rt-dark::before {
|
||||
background: #2a2a2a;
|
||||
border-left-color: #555;
|
||||
border-top-color: #555;
|
||||
}
|
||||
|
||||
.rt-color-popover.rt-dark .rt-popover-header {
|
||||
border-bottom-color: #444;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user