Skip to content

Commit 38f657b

Browse files
committed
[chrome] ux: add padding for the interactable area of dragtabs
1 parent 69d05e4 commit 38f657b

File tree

1 file changed

+35
-23
lines changed

1 file changed

+35
-23
lines changed

packages/chrome/src/components/TabStrip/DragTab.tsx

Lines changed: 35 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -72,32 +72,35 @@ export function DragTab(
7272
style="z-index: 0;"
7373
class="tab"
7474
data-id={props.id}
75-
on:mousedown={(e: MouseEvent) => {
76-
props.mousedown(e);
77-
e.stopPropagation();
78-
e.preventDefault();
79-
}}
80-
on:contextmenu={() => {
81-
if (hoverTimeout) clearTimeout(hoverTimeout);
82-
this.tooltipActive = false;
83-
}}
8475
on:transitionend={() => {
8576
cx.root.style.transition = "";
8677
cx.root.style.zIndex = "0";
8778
props.transitionend();
8879
}}
89-
on:mouseenter={() => {
90-
forceScreenshot(props.tab);
91-
if (hoverTimeout) clearTimeout(hoverTimeout);
92-
hoverTimeout = window.setTimeout(() => {
93-
this.tooltipActive = true;
94-
}, 500);
95-
}}
96-
on:mouseleave={() => {
97-
if (hoverTimeout) clearTimeout(hoverTimeout);
98-
this.tooltipActive = false;
99-
}}
10080
>
81+
<div
82+
class="hover-area"
83+
on:mousedown={(e: MouseEvent) => {
84+
props.mousedown(e);
85+
e.stopPropagation();
86+
e.preventDefault();
87+
}}
88+
on:contextmenu={() => {
89+
if (hoverTimeout) clearTimeout(hoverTimeout);
90+
this.tooltipActive = false;
91+
}}
92+
on:mouseenter={() => {
93+
forceScreenshot(props.tab);
94+
if (hoverTimeout) clearTimeout(hoverTimeout);
95+
hoverTimeout = window.setTimeout(() => {
96+
this.tooltipActive = true;
97+
}, 500);
98+
}}
99+
on:mouseleave={() => {
100+
if (hoverTimeout) clearTimeout(hoverTimeout);
101+
this.tooltipActive = false;
102+
}}
103+
></div>
101104
<TabTooltip tab={props.tab} active={use(this.tooltipActive)} />
102105
<div
103106
class="dragroot"
@@ -126,8 +129,8 @@ export function DragTab(
126129
</button>
127130
</div>
128131
{/* <div class="belowcontainer">
129-
{use(s.active).andThen(<div class="below"></div>)}
130-
</div> */}
132+
{use(s.active).andThen(<div class="below"></div>)}
133+
</div> */}
131134
</div>
132135
</div>
133136
);
@@ -145,6 +148,15 @@ DragTab.style = css`
145148
--tab-selected-textcolor: var(--toolbar_text);
146149
}
147150
151+
.hover-area {
152+
position: absolute;
153+
top: -5px;
154+
left: -3px;
155+
right: -5px;
156+
bottom: -5px;
157+
pointer-events: auto;
158+
}
159+
148160
.main {
149161
height: var(--tab-height);
150162
min-width: 0;
@@ -205,7 +217,7 @@ DragTab.style = css`
205217
border-radius: 3px;
206218
}
207219
208-
.main:not(.active):hover {
220+
:scope:has(.hover-area:hover) .main:not(.active) {
209221
transition: background 250ms;
210222
background-color: color-mix(in srgb, currentColor 7%, transparent);
211223
/*background: var(--background_tab);*/

0 commit comments

Comments
 (0)