Файли
openidea/src/ui/Tree.module.css
T
Ernstjan FreriksтаEjaYF e2817656e8 fix(ui): end tree rows at the scrollbar track (#6468)
While a tree's vertical scrollbar thumb is shown, Scrollbar sets data-scrollbar-shown on its scroller and Tree reserves 8px on the right (the 10px track minus the thumb's 2px border), clipping its rows there. Rows wider than the panel no longer show their text, selection or hover background through the translucent thumb. Trees without a vertical scrollbar keep their 6px inset.

Co-authored-by: EjaYF <[email protected]>
2026-11-27 19:26:04 +08:00

233 рядки
5.1 KiB
CSS

.wrap {
position: relative;
display: flex;
flex-direction: column;
min-height: 0;
height: 100%;
}
/* Tree.border 4,12,4,12 minus the island padding; rows are inset so the rounded selection floats. */
.tree {
flex: 1;
min-height: 0;
overflow: auto;
outline: none;
padding: 0 var(--tree-inset, 6px);
}
/* The thumb is translucent, so rows, including rows wider than the tree, must end where it is
painted: the 10px track minus the thumb's 2px border (Scrollbar.module.css). */
.tree[data-scrollbar-shown] {
padding-right: 8px;
clip-path: inset(0 8px 0 0);
}
.tree::-webkit-scrollbar {
width: 10px;
height: 10px;
}
.tree::-webkit-scrollbar-thumb {
background-color: var(--scrollbar-thumb);
border: 2px solid transparent;
border-radius: 5px;
background-clip: content-box;
}
.tree::-webkit-scrollbar-thumb:hover {
background-color: var(--scrollbar-thumb-hover);
}
.tree::-webkit-scrollbar-track,
.tree::-webkit-scrollbar-corner {
background: transparent;
}
.emptyWrap {
display: flex;
align-items: center;
justify-content: center;
color: var(--fg-faint);
}
.sizer {
position: relative;
width: 100%;
/* Keeps the tint bands of rows above the tree's background. */
isolation: isolate;
}
.row {
position: absolute;
top: 0;
left: 0;
width: 100%;
display: flex;
align-items: center;
gap: var(--space-1);
padding-right: 8px;
border-radius: var(--radius-selection, 5px);
color: var(--fg-strong);
white-space: nowrap;
}
/* At least the visible width so the selection covers it; wider rows overflow the sizer. */
.wideRow {
width: max-content;
min-width: 100%;
}
.contentWidth {
position: absolute;
top: 0;
left: 0;
height: 1px;
pointer-events: none;
}
.row:hover {
background: var(--bg-tree-hover, color-mix(in srgb, var(--fg-strong) 4%, transparent));
}
/* File Colors: a full-width band under the row, so runs of tinted rows read as one block;
hover and selection stay rounded on top of it. */
.tinted::before {
content: "";
position: absolute;
inset: 0 calc(-1 * var(--tree-inset, 6px));
z-index: -1;
background: color-mix(in srgb, var(--row-tint) var(--row-tint-strength, var(--file-tint-strength, 14%)), transparent);
pointer-events: none;
}
/* Tree.selectionInactiveBackground when unfocused, selectionBackground when focused. */
.selected,
.selected:hover {
background: var(--bg-tree-selected-inactive);
}
.tree:focus .selected,
.tree:focus-within .selected {
background: var(--bg-tree-selected);
}
/* Adjacent selected rows merge into one rounded block. */
.joinPrev {
border-top-left-radius: 0;
border-top-right-radius: 0;
}
.joinNext {
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
}
.tree:focus-visible .lead:not(.selected) {
box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--focus-ring) 50%, transparent);
}
.loading {
color: var(--fg-faint);
}
.before::before,
.after::after {
content: "";
position: absolute;
left: 0;
right: 0;
height: 2px;
background: var(--focus-ring);
pointer-events: none;
z-index: 1;
}
.before::before {
top: 0;
}
.after::after {
bottom: 0;
}
.chevron {
flex: none;
width: 16px;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
color: var(--fg-muted);
}
.icon {
flex: none;
margin-right: 2px;
color: var(--fg-muted);
}
.label {
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
}
.detail {
flex-shrink: var(--tree-detail-flex-shrink, 1);
min-width: 0;
margin-left: 4px;
overflow: hidden;
text-overflow: ellipsis;
color: var(--fg-muted);
}
/* SpeedSearch popup above the tree. */
.speedSearch {
position: absolute;
top: 0;
left: 8px;
z-index: var(--z-panel);
display: flex;
align-items: center;
gap: var(--space-1-5);
height: 26px;
max-width: calc(100% - 16px);
padding: 0 10px 0 8px;
border-radius: var(--radius-control, 4px);
background: var(--bg-popup);
border: 1px solid var(--border-popup);
box-shadow: var(--shadow-popup);
color: var(--fg-muted);
font-size: var(--fs-ui);
pointer-events: none;
}
.speedAbove {
top: auto;
bottom: 100%;
left: var(--space-1);
height: var(--h-field);
max-width: calc(100% - 2 * var(--space-1));
padding-inline: var(--space-2);
}
.speedAbove .caret {
margin-inline: calc(-1 * var(--space-1)) 0;
}
/* The field variant sits on the 32px toolbar row above the tree, covering its first buttons. */
.speedField {
top: auto;
bottom: calc(100% + 2px);
left: 6px;
gap: var(--space-1);
height: 28px;
min-width: 160px;
padding: 0 2px 0 8px;
box-shadow: none;
pointer-events: auto;
}
.speedField .speedQuery {
margin-left: 2px;
}
.caret {
flex-shrink: 0;
width: 1px;
height: 16px;
margin: 0 auto 0 -2px;
background: var(--fg-strong);
animation: caret-blink 1s steps(1) infinite;
}
@keyframes caret-blink {
50% {
opacity: 0;
}
}
@media (prefers-reduced-motion: reduce) {
.caret {
animation: none;
}
}
.onlyMatches {
flex-shrink: 0;
}
.speedQuery {
color: var(--fg-strong);
overflow: hidden;
text-overflow: ellipsis;
white-space: pre;
}
.noMatch .speedQuery {
color: var(--danger);
}