Skip to content

Commit ccb8cc9

Browse files
committed
Fix focus state for card image in block editor
1 parent ad4d278 commit ccb8cc9

File tree

3 files changed

+100
-2
lines changed

3 files changed

+100
-2
lines changed

plugin/assets/src/block-editor/blocks/card/edit.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ const Edit = ( { attributes, setAttributes, className } ) => {
100100
cornerRadius,
101101
setter,
102102
isEditMode: true,
103+
isFocused: true,
103104
};
104105

105106
const inspectorControlsStylePanelProps = {

plugin/assets/src/block-editor/blocks/card/editor.css

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,12 @@
3434
}
3535
}
3636

37-
.material-design-card__media-close-button {
37+
.edit-post-visual-editor .material-design-card__media-close-button {
38+
min-width: 0;
3839
padding: 2px !important;
3940

4041
& .dashicon {
41-
margin: 0 !important;
42+
margin: 0;
4243
}
4344
}
4445

plugin/tests/js/block-editor/blocks/card/__snapshots__/edit.test.js.snap

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,30 @@ Object {
581581
src="http://test.loc/test.jpg"
582582
/>
583583
</div>
584+
<div
585+
class="material-design-card__media-actions"
586+
>
587+
<button
588+
aria-label="Remove Card Image"
589+
class="components-button material-design-card__media-close-button has-icon"
590+
type="button"
591+
>
592+
<svg
593+
aria-hidden="true"
594+
class="dashicon dashicons-no"
595+
focusable="false"
596+
height="20"
597+
role="img"
598+
viewBox="0 0 20 20"
599+
width="20"
600+
xmlns="http://www.w3.org/2000/svg"
601+
>
602+
<path
603+
d="M12.12 10l3.53 3.53-2.12 2.12L10 12.12l-3.54 3.54-2.12-2.12L7.88 10 4.34 6.46l2.12-2.12L10 7.88l3.54-3.53 2.12 2.12z"
604+
/>
605+
</svg>
606+
</button>
607+
</div>
584608
</div>
585609
<div
586610
class="material-design-card__primary"
@@ -1213,6 +1237,30 @@ Object {
12131237
src="http://test.loc/test.jpg"
12141238
/>
12151239
</div>
1240+
<div
1241+
class="material-design-card__media-actions"
1242+
>
1243+
<button
1244+
aria-label="Remove Card Image"
1245+
class="components-button material-design-card__media-close-button has-icon"
1246+
type="button"
1247+
>
1248+
<svg
1249+
aria-hidden="true"
1250+
class="dashicon dashicons-no"
1251+
focusable="false"
1252+
height="20"
1253+
role="img"
1254+
viewBox="0 0 20 20"
1255+
width="20"
1256+
xmlns="http://www.w3.org/2000/svg"
1257+
>
1258+
<path
1259+
d="M12.12 10l3.53 3.53-2.12 2.12L10 12.12l-3.54 3.54-2.12-2.12L7.88 10 4.34 6.46l2.12-2.12L10 7.88l3.54-3.53 2.12 2.12z"
1260+
/>
1261+
</svg>
1262+
</button>
1263+
</div>
12161264
</div>
12171265
<div
12181266
class="material-design-card__primary"
@@ -1926,6 +1974,30 @@ Object {
19261974
src="http://test.loc/test.jpg"
19271975
/>
19281976
</div>
1977+
<div
1978+
class="material-design-card__media-actions"
1979+
>
1980+
<button
1981+
aria-label="Remove Card Image"
1982+
class="components-button material-design-card__media-close-button has-icon"
1983+
type="button"
1984+
>
1985+
<svg
1986+
aria-hidden="true"
1987+
class="dashicon dashicons-no"
1988+
focusable="false"
1989+
height="20"
1990+
role="img"
1991+
viewBox="0 0 20 20"
1992+
width="20"
1993+
xmlns="http://www.w3.org/2000/svg"
1994+
>
1995+
<path
1996+
d="M12.12 10l3.53 3.53-2.12 2.12L10 12.12l-3.54 3.54-2.12-2.12L7.88 10 4.34 6.46l2.12-2.12L10 7.88l3.54-3.53 2.12 2.12z"
1997+
/>
1998+
</svg>
1999+
</button>
2000+
</div>
19292001
</div>
19302002
<div
19312003
class="material-design-card__primary"
@@ -2558,6 +2630,30 @@ Object {
25582630
src="http://test.loc/test.jpg"
25592631
/>
25602632
</div>
2633+
<div
2634+
class="material-design-card__media-actions"
2635+
>
2636+
<button
2637+
aria-label="Remove Card Image"
2638+
class="components-button material-design-card__media-close-button has-icon"
2639+
type="button"
2640+
>
2641+
<svg
2642+
aria-hidden="true"
2643+
class="dashicon dashicons-no"
2644+
focusable="false"
2645+
height="20"
2646+
role="img"
2647+
viewBox="0 0 20 20"
2648+
width="20"
2649+
xmlns="http://www.w3.org/2000/svg"
2650+
>
2651+
<path
2652+
d="M12.12 10l3.53 3.53-2.12 2.12L10 12.12l-3.54 3.54-2.12-2.12L7.88 10 4.34 6.46l2.12-2.12L10 7.88l3.54-3.53 2.12 2.12z"
2653+
/>
2654+
</svg>
2655+
</button>
2656+
</div>
25612657
</div>
25622658
<div
25632659
class="material-design-card__primary"

0 commit comments

Comments
 (0)