Compare commits

..
2 Commits
Author SHA1 Message Date
parkel d1a221e01b Merge pull request 'Align checkbox and radio controls across the panel' (#271) from fix/compact-panel-choices into main
Coulobre Panel CI / Checks (Python 3.12) (push) Successful in 1m44s
Coulobre Panel CI / Checks (Python 3.14) (push) Successful in 1m59s
Reviewed-on: #271
2026-12-03 23:54:08 +01:00
parkel f596f092fb Align panel checkboxes and radio choices with their labels
Coulobre Panel CI / Checks (Python 3.12) (pull_request) Successful in 1m47s
Coulobre Panel CI / Checks (Python 3.14) (pull_request) Successful in 1m59s
2026-12-03 23:51:47 +01:00
6 changed files with 92 additions and 12 deletions

No files matched your search

+22
View File
@@ -58,6 +58,28 @@ heading, help, fields, and actions should share a left edge.
and its theme tokens for type, color, spacing, and focus states. Avoid
fixed control widths, inline styles, and page-specific font sizes.
### Checkboxes and radio choices
Place the native control before its label, on the same row. The visible
label should toggle the control, and a long label should wrap underneath
its own text. Keep descriptions and errors below the label text. Preserve
Django's label association, error state, and description IDs.
- For Django-generated forms, use `form.as_div`. When rendering a single
bound field, put `field.as_field_group` in its own wrapper. The shared
stylesheet aligns the control and label without replacing the widget.
- For a handwritten confirmation, wrap the input and text in one label.
Keep radio choices and multi-checkbox groups in a fieldset with a
visible legend naming the group.
- Keep a compound control, such as a numeric quota with **Unlimited**,
in its own editor row. Its checkbox still sits next to its own label.
- Use the shared stylesheet in both Core and Premium. Check click and
keyboard operation, wrapping, and focus in both themes at a narrow width.
```html
<label><input type="checkbox" name="confirm" required> Confirm this change</label>
```
## Review a UI change
Compare the result with a Core page that serves the same purpose. In light
+63 -1
View File
@@ -959,8 +959,65 @@ dd {
width: 100%;
}
.editor input:is([type="checkbox"], [type="radio"]) {
input:is([type="checkbox"], [type="radio"]) {
accent-color: var(--accent);
inline-size: 1rem;
block-size: 1rem;
margin: 0.15rem 0 0;
}
/* Django renders a bound checkbox as a sibling of its label. */
:is(div, p):has(> input[type="checkbox"]):has(> :is(label[for], .plan-field-heading)) {
display: grid;
grid-template-columns: max-content minmax(0, 1fr);
gap: 0.2rem 0.55rem;
align-items: start;
}
:is(div, p):has(> input[type="checkbox"]):has(> :is(label[for], .plan-field-heading)) > * {
grid-column: 2;
}
:is(div, p):has(> input[type="checkbox"]):has(> :is(label[for], .plan-field-heading)) > input[type="checkbox"] {
grid-area: 1 / 1;
}
:is(div, p):has(> input[type="checkbox"]):has(> :is(label[for], .plan-field-heading)) > :is(label[for], .plan-field-heading) {
grid-row: 1;
margin-block-end: 0;
overflow-wrap: anywhere;
}
:is(div, p):has(> input[type="checkbox"]):has(> :is(label[for], .plan-field-heading)) > .helptext {
color: var(--muted);
}
/* Handwritten confirmations and Django choice widgets wrap the input. */
label:has(> input:is([type="checkbox"], [type="radio"]):first-child) {
display: grid;
grid-template-columns: max-content minmax(0, 1fr);
column-gap: 0.55rem;
align-items: start;
margin-block-end: 0;
overflow-wrap: anywhere;
}
fieldset:has(> div > div > label > input:is([type="checkbox"], [type="radio"])) {
min-inline-size: 0;
border: 0;
margin: 0;
padding: 0;
}
fieldset:has(> div > div > label > input:is([type="checkbox"], [type="radio"])) > legend {
margin-block-end: 0.35rem;
padding: 0;
font-weight: var(--font-weight-semibold);
}
fieldset > div:has(> div > label > input:is([type="checkbox"], [type="radio"])) {
display: grid;
gap: 0.4rem;
}
.limit-control {
@@ -973,6 +1030,11 @@ dd {
min-width: 0;
}
.limit-control input[type="checkbox"] {
flex: none;
margin: 0;
}
.limit-control label {
display: inline-flex;
align-items: center;
@@ -26,8 +26,8 @@
<summary>Zone settings</summary>
{{ form.nameservers.as_field_group }}
{{ form.responsible_name.as_field_group }}
{{ form.delegate_dns.as_field_group }}
{{ form.manage_mail_dns.as_field_group }}
<div>{{ form.delegate_dns.as_field_group }}</div>
<div>{{ form.manage_mail_dns.as_field_group }}</div>
</details>
{% endif %}
<div data-dns-text-fields>
@@ -28,11 +28,7 @@
{{ form.non_field_errors }}
{{ form.revision }}
{% for field in form.visible_fields %}
<div>
<label for="{{ field.id_for_label }}">{{ field }} {{ field.label }}</label>
{{ field.errors }}
<p class="heading-meta" id="{{ field.id_for_label }}_helptext">{{ field.help_text }}</p>
</div>
<div>{{ field.as_field_group }}</div>
{% empty %}
<p>No installed features can be configured here yet.</p>
{% endfor %}
@@ -12,10 +12,10 @@
{% else %}
<p>Send the selected notifications to {{ request.user.email }}.</p>
{% endif %}
<form method="post">
<form method="post" class="editor">
{% csrf_token %}
{{ form.as_p }}
<button type="submit" class="button primary">Save preferences</button>
{{ form.as_div }}
<div class="form-actions"><button type="submit" class="button primary">Save preferences</button></div>
</form>
</section>
{% if deliveries %}
@@ -49,7 +49,7 @@
{{ form.plan.as_field_group }}
{{ form.password.as_field_group }}
</details>
{{ form.confirmed.as_field_group }}
<div>{{ form.confirmed.as_field_group }}</div>
<div class="form-actions"><button class="button primary" type="submit">Start installation</button></div>
</form>
{% endif %}