Skip to content

Commit 88f6f90

Browse files
committed
Fixes collapsing repo name on current work item section
Adds an `ignoreFocusWithin` property to the breadcrumb item that lets it to collapse even when it holds the focus after a click. This allows to prevent the breadcrumb item from expanding when focused. (#4387, #4402)
1 parent e2753c4 commit 88f6f90

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

src/webviews/apps/plus/home/components/active-work.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ export class GlActiveWork extends SignalWatcher(LitElement) {
156156
return html`
157157
<gl-section ?loading=${isFetching}>
158158
<gl-breadcrumbs slot="heading">
159-
<gl-breadcrumb-item collapsibleState="collapsed" icon="repo"
159+
<gl-breadcrumb-item collapsibleState="collapsed" icon="repo" .ignoreFocusWithin=${true}
160160
><gl-repo-button-group
161161
.repository=${repo}
162162
.icon=${false}

src/webviews/apps/shared/components/breadcrumbs.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,8 @@ export class GlBreadcrumbItem extends LitElement {
143143
transition: max-width 0.3s cubic-bezier(0.25, 1, 0.5, 1);
144144
}
145145
146+
:host([collapsed]) .breadcrumb-item:not(:hover).ignore-focus-within .breadcrumb-label,
147+
:host([collapsed]) .breadcrumb-item:not(:hover).ignore-focus-within slot[name='children'],
146148
:host([collapsed]) .breadcrumb-item:not(:hover):not(:focus-within) .breadcrumb-label,
147149
:host([collapsed]) .breadcrumb-item:not(:hover):not(:focus-within) slot[name='children'] {
148150
max-width: 0;
@@ -170,6 +172,9 @@ export class GlBreadcrumbItem extends LitElement {
170172
@property()
171173
icon?: string;
172174

175+
@property()
176+
ignoreFocusWithin?: boolean;
177+
173178
@property()
174179
iconTooltip?: string;
175180

@@ -186,9 +191,15 @@ export class GlBreadcrumbItem extends LitElement {
186191
}
187192

188193
override render() {
189-
const { collapsed, collapsible } = this;
190-
191-
return html`<div class=${classMap({ 'breadcrumb-item': true, collapsible: collapsible })}>
194+
const { collapsed, collapsible, ignoreFocusWithin } = this;
195+
196+
return html`<div
197+
class=${classMap({
198+
'breadcrumb-item': true,
199+
collapsible: collapsible,
200+
'ignore-focus-within': ignoreFocusWithin ?? false,
201+
})}
202+
>
192203
<span class="breadcrumb-content">
193204
${this.renderIcon(collapsible, collapsed)}
194205
<slot class="breadcrumb-label"></slot>

0 commit comments

Comments
 (0)