Skip to content

Commit d325a92

Browse files
authored
fix: selection card wiggle (#2047)
1 parent 7dfd93d commit d325a92

File tree

3 files changed

+18
-41
lines changed

3 files changed

+18
-41
lines changed

src/library-authoring/components/BaseCard.scss

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,37 +8,22 @@
88
}
99

1010
&.selected:not(:focus) {
11-
border: 2px $gray-700 solid;
12-
13-
.library-item-header {
14-
border-top-left-radius: calc(.375rem - 2px);
15-
border-top-right-radius: calc(.375rem - 2px);
16-
}
11+
outline: 2px $gray-700 solid;
1712
}
1813

1914
&.selected:focus {
20-
border: 3px $gray-700 solid;
21-
22-
.library-item-header {
23-
border-top-left-radius: calc(.375rem - 3px);
24-
border-top-right-radius: calc(.375rem - 3px);
25-
}
15+
outline: 3px $gray-700 solid;
2616
}
2717

2818
&:not(.selected):focus {
2919
outline: 1px $gray-200 solid;
3020
outline-offset: 2px;
3121
}
3222

33-
&:not(.selected) {
34-
.library-item-header {
35-
border-top-left-radius: .375rem;
36-
border-top-right-radius: .375rem;
37-
}
38-
}
39-
4023
.library-item-header {
4124
padding: 0 .5rem 0 1.25rem;
25+
border-top-left-radius: .375rem;
26+
border-top-right-radius: .375rem;
4227

4328
.library-item-header-icon {
4429
width: 2.3rem;

src/library-authoring/units/LibraryUnitBlocks.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -177,16 +177,12 @@ const ComponentBlock = ({ block, preview, isDragging }: ComponentBlockProps) =>
177177
maxHeight: '200px',
178178
overflowY: 'hidden',
179179
};
180-
} if (componentId === block.originalId) {
181-
return {
182-
outline: '2px solid black',
183-
};
184180
}
185181
return {};
186182
}, [isDragging, componentId, block]);
187183

188184
const selected = sidebarComponentInfo?.type === SidebarBodyComponentId.ComponentInfo
189-
&& sidebarComponentInfo?.id === block.id;
185+
&& sidebarComponentInfo?.id === block.originalId;
190186

191187
return (
192188
<IframeProvider>

src/library-authoring/units/index.scss

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,37 +5,33 @@
55
margin-bottom: 1rem;
66
border: solid 1px $light-500;
77

8-
&::before {
9-
border: none !important; // Remove default focus
8+
}
9+
10+
.pgn__card.clickable {
11+
box-shadow: none;
12+
// this is required for clicks to be captured by card and iframe when it is not in focus
13+
pointer-events: auto;
14+
15+
&:focus {
16+
// this is required for clicks to be passed to underlying iframe component
17+
pointer-events: none;
1018
}
1119

1220
&.selected:not(:focus) {
13-
border: 2px $gray-700 solid;
21+
outline: 2px $gray-700 solid;
1422
}
1523

1624
&.selected:focus {
17-
border: 3px $gray-700 solid;
25+
outline: 3px $gray-700 solid;
1826
}
1927

2028
&:not(.selected):focus {
2129
outline: 1px $gray-200 solid;
2230
outline-offset: 2px;
2331
}
24-
}
25-
26-
.pgn__card.clickable {
27-
box-shadow: none;
28-
// this is required for clicks to be captured by card and iframe when it is not in focus
29-
pointer-events: auto;
30-
31-
&:focus {
32-
// this is required for clicks to be passed to underlying iframe component
33-
pointer-events: none;
34-
outline: solid 1px $dark-500;
35-
}
3632

3733
&::before {
38-
border: none;
34+
border: none !important; // Remove default focus
3935
}
4036
}
4137

0 commit comments

Comments
 (0)