Skip to content

Commit df298dc

Browse files
arraypressclaude
andcommitted
Keep the gallery tile to a cross and a grab
The script adds a move-up and a move-down button to every tile for the keyboard, and the stylesheet had nothing to say about them, so each picture sat over a bar of chevrons. They are overlay controls now, along the bottom edge, revealed with the cross on hover or focus and always shown where nothing can hover. The cross itself is the small white disc a picture's remove control is everywhere else in the admin. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015Kwx2STJ4EaVaJofEJJ9Zo
1 parent 02d4640 commit df298dc

1 file changed

Lines changed: 65 additions & 2 deletions

File tree

‎assets/css/field-kit.css‎

Lines changed: 65 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -703,15 +703,76 @@ input[type="checkbox"].field-kit__toggle:focus-visible {
703703
color: #fff;
704704
}
705705

706+
/* The cross is a small white disc in the corner, which is what a cross
707+
for removing a picture looks like everywhere else in the admin. */
708+
.wp-core-ui .field-kit__gallery-remove {
709+
width: 1.5rem;
710+
height: 1.5rem;
711+
border-radius: 50%;
712+
box-shadow: 0 0 0 1px rgba(0, 0, 0, .12);
713+
}
714+
715+
/* The move buttons the script adds for the keyboard. Nobody with a mouse
716+
needs them -- the tile drags -- so they sit along the bottom edge and
717+
show up with the cross: on hover, on focus, and always where there is
718+
no hover to wait for. Left as flow content they came out as a bar of
719+
chevrons under every picture. */
720+
.wp-core-ui .field-kit__gallery-item .field-kit__gallery-move {
721+
position: absolute;
722+
bottom: .2rem;
723+
z-index: 1;
724+
background: rgba(255, 255, 255, .92);
725+
color: #1d2327;
726+
opacity: 0;
727+
transition: opacity .1s ease-in-out;
728+
}
729+
730+
.wp-core-ui .field-kit__gallery-item .field-kit__gallery-move[data-direction="up"] {
731+
inset-inline-start: .2rem;
732+
}
733+
734+
.wp-core-ui .field-kit__gallery-item .field-kit__gallery-move[data-direction="down"] {
735+
inset-inline-end: .2rem;
736+
}
737+
738+
.field-kit__gallery-item:hover .field-kit__gallery-move,
739+
.field-kit__gallery-item:focus-within .field-kit__gallery-move,
740+
.wp-core-ui .field-kit__gallery-move:focus-visible {
741+
opacity: 1;
742+
}
743+
744+
.wp-core-ui .field-kit__gallery-move:hover,
745+
.wp-core-ui .field-kit__gallery-move:focus {
746+
background: #fff;
747+
color: var(--wp-admin-theme-color, #2271b1);
748+
}
749+
750+
.wp-core-ui .field-kit__gallery-move:disabled {
751+
color: #c3c4c7;
752+
cursor: default;
753+
}
754+
755+
/* In a row -- a file with a name and a player rather than a picture -- the
756+
controls sit in the line beside the name, always visible. */
757+
.wp-core-ui .field-kit__gallery-item--file .field-kit__gallery-move,
758+
.wp-core-ui .field-kit__gallery-item--file .field-kit__gallery-remove {
759+
position: static;
760+
opacity: 1;
761+
box-shadow: none;
762+
background: none;
763+
}
764+
706765
/* Nothing may be revealed by hover alone where hovering is not possible. */
707766
@media (hover: none) {
708-
.wp-core-ui .field-kit__gallery-remove {
767+
.wp-core-ui .field-kit__gallery-remove,
768+
.wp-core-ui .field-kit__gallery-item .field-kit__gallery-move {
709769
opacity: 1;
710770
}
711771
}
712772

713773
@media (prefers-reduced-motion: reduce) {
714-
.wp-core-ui .field-kit__gallery-remove {
774+
.wp-core-ui .field-kit__gallery-remove,
775+
.wp-core-ui .field-kit__gallery-item .field-kit__gallery-move {
715776
transition: none;
716777
}
717778
}
@@ -1826,6 +1887,7 @@ li.field-kit__repeater-row {
18261887
it, so a bare class here loses and every chevron carries a line under it.
18271888
Matching the prefix is what makes these win. */
18281889
.wp-core-ui .field-kit__gallery-remove,
1890+
.wp-core-ui .field-kit__gallery-move,
18291891
.wp-core-ui .field-kit__repeater-remove,
18301892
.wp-core-ui .field-kit__sortable-move {
18311893
display: inline-flex;
@@ -1865,6 +1927,7 @@ li.field-kit__repeater-row {
18651927
line-height of surrounding text. */
18661928
.field-kit__sortable-move .dashicons,
18671929
.field-kit__gallery-remove .dashicons,
1930+
.field-kit__gallery-move .dashicons,
18681931
.field-kit__repeater-remove .dashicons {
18691932
width: 1rem;
18701933
height: 1rem;

0 commit comments

Comments
 (0)