-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Try: Reduce checkbox size in data views #60475
Changes from 7 commits
8094a38
7f23422
7d5e821
67f6b74
16ee29f
a5da16d
3ebe6cc
ee6fa8a
a3a30f6
5c54416
3aeb44f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
$checkbox-input-size: 20px; | ||
$checkbox-input-size-sm: 24px; // Width & height for small viewports. | ||
.components-checkbox-control { | ||
--checkbox-input-size: 24px; // Width & height for small viewports. | ||
|
||
@include break-small() { | ||
--checkbox-input-size: var(--wp-components-checkbox-control-size, 20px); | ||
} | ||
} | ||
|
||
.components-checkbox-control__input[type="checkbox"] { | ||
@include checkbox-control; | ||
|
@@ -14,13 +19,8 @@ $checkbox-input-size-sm: 24px; // Width & height for small viewports. | |
padding: 0 !important; | ||
text-align: center; | ||
vertical-align: top; | ||
width: $checkbox-input-size-sm; | ||
height: $checkbox-input-size-sm; | ||
|
||
@include break-small() { | ||
height: $checkbox-input-size; | ||
width: $checkbox-input-size; | ||
} | ||
width: var(--checkbox-input-size); | ||
aspect-ratio: 1; | ||
|
||
appearance: none; | ||
transition: 0.1s border-color ease-in-out; | ||
|
@@ -51,29 +51,26 @@ $checkbox-input-size-sm: 24px; // Width & height for small viewports. | |
display: inline-block; | ||
margin-right: 12px; | ||
vertical-align: middle; | ||
width: $checkbox-input-size-sm; | ||
height: $checkbox-input-size-sm; | ||
|
||
@include break-small() { | ||
width: $checkbox-input-size; | ||
height: $checkbox-input-size; | ||
} | ||
width: var(--checkbox-input-size); | ||
aspect-ratio: 1; | ||
} | ||
|
||
svg.components-checkbox-control__checked, | ||
svg.components-checkbox-control__indeterminate { | ||
--checkmark-size: var(--checkbox-input-size); | ||
|
||
fill: $white; | ||
cursor: pointer; | ||
position: absolute; | ||
left: 0; | ||
top: 0; | ||
width: $button-size-small; | ||
height: $button-size-small; | ||
left: 50%; | ||
top: 50%; | ||
transform: translate(-50%, -50%); | ||
width: var(--checkmark-size); | ||
height: var(--checkmark-size); | ||
user-select: none; | ||
pointer-events: none; | ||
|
||
@include break-small() { | ||
left: -2px; | ||
top: -2px; | ||
--checkmark-size: calc(var(--checkbox-input-size) + 4px); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Currently in trunk, the icon size is 24px regardless of whether the input is 20px or 24px. I left it that way, but we could simplify the code (and possibly correct the visual incongruence) if that was unintended. |
||
user-select: none; | ||
pointer-events: none; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,8 @@ | |
overflow: auto; | ||
box-sizing: border-box; | ||
scroll-padding-bottom: $grid-unit-80; | ||
|
||
--wp-components-checkbox-control-size: 16px; | ||
} | ||
|
||
.dataviews-filters__view-actions { | ||
|
@@ -92,10 +94,6 @@ | |
&.dataviews-view-table__checkbox-column { | ||
padding-right: 0; | ||
} | ||
|
||
.components-checkbox-control__input-container { | ||
margin: $grid-unit-05; | ||
} | ||
} | ||
tr { | ||
border-bottom: 1px solid $gray-100; | ||
|
@@ -532,16 +530,19 @@ | |
justify-content: center; | ||
} | ||
|
||
.dataviews-view-table-selection-checkbox label { | ||
position: absolute; | ||
width: 1px; | ||
height: 1px; | ||
padding: 0; | ||
margin: -1px; | ||
overflow: hidden; | ||
clip: rect(0, 0, 0, 0); | ||
white-space: nowrap; | ||
border: 0; | ||
.dataviews-view-table-selection-checkbox { | ||
line-height: 0; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Without this the checkbox wrapper renders at 18.58px tall which throws off the horizontal alignment with the smaller checkboxes. |
||
label { | ||
position: absolute; | ||
Comment on lines
+539
to
+540
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry for the pain here, we do eventually want to make this kind of checkbox layout possible without hacks! I'll bump the priority. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jameskoster I was thinking about this in the context of #60799 and realized it was already possible. Quick fix proposed in #60835. |
||
width: 1px; | ||
height: 1px; | ||
padding: 0; | ||
margin: -1px; | ||
overflow: hidden; | ||
clip: rect(0, 0, 0, 0); | ||
white-space: nowrap; | ||
border: 0; | ||
} | ||
} | ||
|
||
.dataviews-filters__custom-menu-radio-item-prefix { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's keep the size for small viewports private for now, since we don't need to override it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Scratch that. I discussed this with @DaniGuardiola and decided that we shouldn't be exposing an official-looking CSS var for this sizing experiment. Made some changes on how we override it. On the whole though, this style refactor should allow more of a safer override, although not "officially" sanctioned.