A calendar a phone can read, and tap targets a thumb can hit
The private calendar rendered as six hundred pixels of nothing on a phone.
The cause was two adjacent rules in board.css with opposite outcomes:
.cal, .cal tbody, .cal tr, .cal td { display: block } /* (0,1,1) */
.cal__pad { display: none } /* (0,1,0) */
.cal__day:not(:has(.cal__event)) { display: none } /* (0,2,0) */
`.cal td` outranks `.cal__pad`, so every cell belonging to a neighbouring
month stayed on screen as a 92px empty box; `.cal__day:not(:has(…))`
outranks `.cal td`, so every real day disappeared. A month with no events
drew four blank boxes and nothing else, with correct HTML throughout —
which is why reading the file looked right and no test could see it.
Both calendars are now a column of every day of the month below 640px,
with the weekday beside the number (the column header is hidden there),
the days carrying something standing out, and a line saying so when the
month is empty. The public agenda gets the same shape deliberately: the
private calendar lists the public events, and a member moves between the
two. Every rule that decides `display` now names its cell's own class.
Measured rather than reasoned about, in headless Chromium at 320 and 390
across all 22 members-area screens and the public site in three languages:
- padding cells 0px tall, 31 of 31 days drawn, no horizontal overflow
- the ☰ ran off the right edge of a 320px Portuguese home page, because
«Comunidade» is three letters longer than «Comunidad»; the bar now
gives way at 360px
- the navigation links were 37x17, the calendar's + was 7x15, the footer
links 16px tall. A `pointer: coarse` block in each stylesheet raises
them to 44, padding only, so the desktop is untouched. Links inside a
sentence are left alone, as WCAG exempts them.
Registro de actividad and Contenido stop being a sideways-scrolling table
on a phone and stack one card per row, the two columns that do not
describe themselves labelled from `data-label`.
Guards: three stylesheet tests that compute specificity and run the
cascade for a padding cell, a day cell and the weekday label, in both
stylesheets — each verified by putting the shipped rules back. Plus three
request-level tests: an empty month says so and still draws its 31 days,
a month with events does not claim to be empty, and every day carries the
right weekday.
Members area only to deploy — no migration, no schema change — except the
agenda and the stylesheet, which reach the site through the pipeline.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NizVpJ2dwzCbjCrTLCjeHn
This commit is contained in:
parent
64b9d3b805
commit
59b595170f
@ -309,9 +309,35 @@ textarea { resize: vertical; line-height: 1.55; }
|
|||||||
word-break: break-all;
|
word-break: break-all;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* A table on a phone becomes one card per row.
|
||||||
|
*
|
||||||
|
* It used to be `display: block; overflow-x: auto`, which is a sideways scroll
|
||||||
|
* inside the page: on Contenido, four columns at 390px put «Editar» and
|
||||||
|
* «Eliminar» off the right edge with nothing on screen saying they were there,
|
||||||
|
* and the timestamp column of the Registro broke across three lines. Stacking
|
||||||
|
* keeps every cell reachable and costs the markup nothing — the same table
|
||||||
|
* serves both widths.
|
||||||
|
*
|
||||||
|
* The columns that do not describe themselves (a bare date, a bare event date)
|
||||||
|
* carry a `data-label` in the template, drawn here by `attr()`. The ones that
|
||||||
|
* do — a title, a name, a sentence — are left alone, because a label on every
|
||||||
|
* line is a form, not a list. */
|
||||||
@media (max-width: 640px) {
|
@media (max-width: 640px) {
|
||||||
.feed-head { flex-direction: column; align-items: flex-start; }
|
.feed-head { flex-direction: column; align-items: flex-start; }
|
||||||
.table { display: block; overflow-x: auto; }
|
|
||||||
|
.table, .table tbody, .table tr, .table td { display: block; width: auto; }
|
||||||
|
.table thead { display: none; }
|
||||||
|
.table tr { padding: 0.85rem 1rem; border-bottom: 1px solid var(--border-light); }
|
||||||
|
.table tr:last-child { border-bottom: 0; }
|
||||||
|
.table td { padding: 0.15rem 0; border: 0; }
|
||||||
|
/* An empty cell would otherwise be a blank line in the middle of the card —
|
||||||
|
an article with no event date, a row with no actions. */
|
||||||
|
.table td:empty { display: none; }
|
||||||
|
.table td[data-label]::before {
|
||||||
|
content: attr(data-label) " ";
|
||||||
|
color: var(--muted);
|
||||||
|
font-size: 0.8rem;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --- editor ----------------------------------------------------------- */
|
/* --- editor ----------------------------------------------------------- */
|
||||||
@ -709,6 +735,12 @@ input[type="file"] {
|
|||||||
.cal__pad { background: transparent; border-color: transparent; }
|
.cal__pad { background: transparent; border-color: transparent; }
|
||||||
.cal__day--today { border-color: var(--brand); background: var(--brand-softer); }
|
.cal__day--today { border-color: var(--brand); background: var(--brand-softer); }
|
||||||
.cal__number { color: var(--subtle); font-weight: 700; }
|
.cal__number { color: var(--subtle); font-weight: 700; }
|
||||||
|
/* The column header carries the weekday at this width, so saying it again in
|
||||||
|
every one of thirty-one cells would be noise. The phone block below, where
|
||||||
|
there is no header row, is the only place it shows. */
|
||||||
|
.cal__weekday { display: none; }
|
||||||
|
.cal__events { display: block; }
|
||||||
|
.cal__empty { margin: -0.5rem 0 1rem; text-align: center; }
|
||||||
|
|
||||||
.cal__event {
|
.cal__event {
|
||||||
display: block;
|
display: block;
|
||||||
@ -735,15 +767,44 @@ input[type="file"] {
|
|||||||
|
|
||||||
.event-facts p { margin: 0 0 0.25rem; }
|
.event-facts p { margin: 0 0 0.25rem; }
|
||||||
|
|
||||||
/* Seven columns of nothing is what a month grid is on a phone. */
|
/* Seven columns of nothing is what a month grid is on a phone, so the month
|
||||||
|
* becomes a column of days — every day, in order, with its weekday beside it.
|
||||||
|
*
|
||||||
|
* Every rule here that decides `display` names the cell's own class, and that
|
||||||
|
* is the point rather than a style preference. The version that shipped opened
|
||||||
|
* with `.cal td { display: block }` — specificity (0,1,1) — which outranked
|
||||||
|
* `.cal__pad { display: none }` at (0,1,0), so the padding cells stayed on
|
||||||
|
* screen as 92px empty boxes; while `.cal__day:not(:has(.cal__event))` at
|
||||||
|
* (0,2,0) won, so every real day disappeared. A month with no events drew four
|
||||||
|
* blank boxes and nothing else, which is exactly what a phone showed. The two
|
||||||
|
* rules were adjacent and had opposite outcomes, which is why reading them
|
||||||
|
* looked right. */
|
||||||
@media (max-width: 640px) {
|
@media (max-width: 640px) {
|
||||||
.cal, .cal tbody, .cal tr, .cal td { display: block; width: auto; }
|
.cal, .cal tbody, .cal tr { display: block; width: auto; }
|
||||||
.cal thead { display: none; }
|
.cal thead { display: none; }
|
||||||
.cal__pad { display: none; }
|
.cal td.cal__pad { display: none; }
|
||||||
.cal__day { height: auto; margin-bottom: 0.4rem; }
|
.cal td.cal__day {
|
||||||
.cal__day:not(:has(.cal__event)) { display: none; }
|
display: flex;
|
||||||
.cal__number { display: inline-block; margin-right: 0.5rem; }
|
align-items: baseline;
|
||||||
.cal__add { display: inline; }
|
gap: 0.6rem;
|
||||||
|
height: auto;
|
||||||
|
min-height: 44px;
|
||||||
|
margin-bottom: 0.3rem;
|
||||||
|
}
|
||||||
|
/* A week still reads as a week. */
|
||||||
|
.cal tr + tr { margin-top: 0.5rem; }
|
||||||
|
/* Fixed, so the dates line up down the page rather than stepping in and
|
||||||
|
out as the weekday names change length. */
|
||||||
|
.cal__date { flex: 0 0 4.2rem; }
|
||||||
|
/* `display` and not only the colour: the base rule hides this, because up
|
||||||
|
there the column header says the weekday. Leaving it out left every row
|
||||||
|
reading as a bare number — the same shape of mistake as the pads, caught
|
||||||
|
the same way, by looking at the rendered page. */
|
||||||
|
.cal__weekday { display: inline; color: var(--subtle); }
|
||||||
|
.cal__events { flex: 1; min-width: 0; }
|
||||||
|
/* No hover on a phone, so the + is simply there; `float` would take it out
|
||||||
|
of the flex row it is now part of. */
|
||||||
|
.cal__add { display: inline-flex; float: none; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --- Gestión → Marca ---------------------------------------------------- */
|
/* --- Gestión → Marca ---------------------------------------------------- */
|
||||||
@ -879,3 +940,64 @@ input[type="file"] {
|
|||||||
.tag--ok { background: #e4f2e4; color: #1b5e20; }
|
.tag--ok { background: #e4f2e4; color: #1b5e20; }
|
||||||
.tag--warn { background: var(--brand-soft); color: var(--brand-dark); }
|
.tag--warn { background: var(--brand-soft); color: var(--brand-dark); }
|
||||||
.tag--bad { background: #f6dcdc; color: var(--danger); }
|
.tag--bad { background: #f6dcdc; color: var(--danger); }
|
||||||
|
|
||||||
|
/* --- a thumb is not a mouse --------------------------------------------- */
|
||||||
|
/*
|
||||||
|
* A coarse pointer is a touchscreen, not a narrow window — so this is keyed on
|
||||||
|
* the pointer rather than on width, and a phone held in landscape gets it too.
|
||||||
|
*
|
||||||
|
* Everything in here is padding. No type size, colour or spacing changes, so
|
||||||
|
* the desktop is untouched and the pages look identical; only the hit boxes
|
||||||
|
* grow. The numbers come from measuring the rendered pages at 390px: the
|
||||||
|
* navigation links were 37x17, the calendar's + was 7x15, and «Editar»,
|
||||||
|
* «Eliminar» and «Vista previa» were 16px tall.
|
||||||
|
*
|
||||||
|
* `.linkish` is deliberately not raised everywhere: it is used mid-sentence in
|
||||||
|
* several places, where a 44px line box overlaps the lines above and below it.
|
||||||
|
* It is raised where it is a control rather than a word — which covers every
|
||||||
|
* one of the measured cases.
|
||||||
|
*/
|
||||||
|
@media (pointer: coarse) {
|
||||||
|
.page-nav { gap: 0.1rem 1.5rem; }
|
||||||
|
/* Every number here was measured rather than guessed: the padding is
|
||||||
|
whatever that control's own line box needs to reach 44px, which is the
|
||||||
|
part of a fingertip a phone can actually locate. 0.7rem on the
|
||||||
|
navigation came out at 40, so it is 0.85rem. */
|
||||||
|
.page-nav a { display: inline-block; padding: 0.85rem 0; }
|
||||||
|
|
||||||
|
.account__menu a, .account__menu button { padding: 0.8rem 0.5rem; }
|
||||||
|
|
||||||
|
.actions .linkish,
|
||||||
|
.feed-head .linkish,
|
||||||
|
.cal-bar .linkish,
|
||||||
|
.cal-bar__today a,
|
||||||
|
.pager a {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 0.9rem 0;
|
||||||
|
}
|
||||||
|
.tab { padding: 0.9rem 1.1rem; }
|
||||||
|
|
||||||
|
.md-bar__button { min-height: 44px; min-width: 44px; }
|
||||||
|
.reaction__button { padding: 0.65rem 0.9rem; }
|
||||||
|
|
||||||
|
/* The buttons and the two links that live in the chrome: the brand at the
|
||||||
|
top left, which is how you get back to the public site, and the footer's
|
||||||
|
own link to it. Both were a line of text with no padding at all. */
|
||||||
|
.btn { padding-top: 0.85rem; padding-bottom: 0.85rem; }
|
||||||
|
.site-bar__brand { display: inline-block; padding: 0.7rem 0; }
|
||||||
|
.site-foot a { display: inline-block; padding: 0.9rem 0; }
|
||||||
|
|
||||||
|
/* Every fold in the members area — Gestionar on a member, Bloquear, the
|
||||||
|
typeface warning, Avanzado on Marca. A <summary> is the control, and at
|
||||||
|
15px it is a control you miss and then press something else. */
|
||||||
|
summary { padding: 0.95rem 0; }
|
||||||
|
.account__name { padding: 0.9rem 0; }
|
||||||
|
|
||||||
|
.cal__add {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
min-width: 44px;
|
||||||
|
min-height: 44px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -25,6 +25,13 @@
|
|||||||
<a href="{{ url_for('events.month', mes=this_month) }}">Ir a este mes</a>
|
<a href="{{ url_for('events.month', mes=this_month) }}">Ir a este mes</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
{# Said above the grid rather than below it: on a phone the month is a column
|
||||||
|
of days, and a line under thirty-one empty rows is a line nobody reads. The
|
||||||
|
public agenda says the same thing in its own words (agenda.html). #}
|
||||||
|
{% if not by_day %}
|
||||||
|
<p class="muted cal__empty">No hay nada en {{ label }}.</p>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<table class="cal">
|
<table class="cal">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>{% for day in weekdays %}<th scope="col">{{ day }}</th>{% endfor %}</tr>
|
<tr>{% for day in weekdays %}<th scope="col">{{ day }}</th>{% endfor %}</tr>
|
||||||
@ -39,7 +46,18 @@
|
|||||||
<td class="cal__pad"></td>
|
<td class="cal__pad"></td>
|
||||||
{% else %}
|
{% else %}
|
||||||
<td class="cal__day {{ 'cal__day--today' if day == today }}">
|
<td class="cal__day {{ 'cal__day--today' if day == today }}">
|
||||||
|
{# The weekday travels with the number because on a phone the
|
||||||
|
header row is hidden — the grid is a column there, and a day
|
||||||
|
without its weekday is just an integer. `loop.index0` of this
|
||||||
|
loop *is* the weekday, since each week is seven cells
|
||||||
|
starting on Monday, so nothing has to be computed in Python.
|
||||||
|
Above 640px .cal__weekday is display:none and the column
|
||||||
|
header says it instead. #}
|
||||||
|
<span class="cal__date">
|
||||||
|
<span class="cal__weekday">{{ weekdays[loop.index0] }}</span>
|
||||||
<span class="cal__number">{{ day }}</span>
|
<span class="cal__number">{{ day }}</span>
|
||||||
|
</span>
|
||||||
|
<span class="cal__events">
|
||||||
{% for item in by_day.get(day, []) %}
|
{% for item in by_day.get(day, []) %}
|
||||||
<a class="cal__event {{ 'cal__event--public' if item.public }}"
|
<a class="cal__event {{ 'cal__event--public' if item.public }}"
|
||||||
href="{{ item.url }}">
|
href="{{ item.url }}">
|
||||||
@ -47,6 +65,7 @@
|
|||||||
{% if item.public %}<span class="tag tag--quiet">público</span>{% endif %}
|
{% if item.public %}<span class="tag tag--quiet">público</span>{% endif %}
|
||||||
</a>
|
</a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
</span>
|
||||||
{% if may_edit %}
|
{% if may_edit %}
|
||||||
{# The day is carried into the form, so adding something to the
|
{# The day is carried into the form, so adding something to the
|
||||||
24th starts with the 24th already filled in. #}
|
24th starts with the 24th already filled in. #}
|
||||||
|
|||||||
@ -30,11 +30,13 @@
|
|||||||
<a href="{{ url_for('content.edit', collection=collection, name=item.name) }}">{{ item.title }}</a>
|
<a href="{{ url_for('content.edit', collection=collection, name=item.name) }}">{{ item.title }}</a>
|
||||||
<div class="muted small mono">{{ item.name }}</div>
|
<div class="muted small mono">{{ item.name }}</div>
|
||||||
</td>
|
</td>
|
||||||
{% if meta.dated %}<td>{{ item.date }}</td>{% endif %}
|
{# data-label is drawn by board.css under 640px, where the header row
|
||||||
|
is hidden and a bare date in a stacked card says nothing. #}
|
||||||
|
{% if meta.dated %}<td data-label="Fecha">{{ item.date }}</td>{% endif %}
|
||||||
{# The column that used to hold the categories. An event date is the
|
{# The column that used to hold the categories. An event date is the
|
||||||
one thing left that changes what a post is, and it is what a
|
one thing left that changes what a post is, and it is what a
|
||||||
moderator scanning this list is looking for. #}
|
moderator scanning this list is looking for. #}
|
||||||
{% if meta.dated %}<td>{{ item.event_date }}</td>{% endif %}
|
{% if meta.dated %}<td data-label="Evento">{{ item.event_date }}</td>{% endif %}
|
||||||
{# The flex row goes INSIDE the cell, never on it. `.actions` is
|
{# The flex row goes INSIDE the cell, never on it. `.actions` is
|
||||||
display:flex, and a <td> told to be a flex container stops being a
|
display:flex, and a <td> told to be a flex container stops being a
|
||||||
table cell: it leaves the row's layout and draws its bottom border
|
table cell: it leaves the row's layout and draws its bottom border
|
||||||
|
|||||||
@ -9,6 +9,7 @@ easy to get subtly wrong and hard to notice.
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import re
|
||||||
from datetime import date
|
from datetime import date
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
@ -117,6 +118,52 @@ def test_february_in_a_leap_year_has_twenty_nine_days(client, superadmin_id, sig
|
|||||||
assert ">30<" not in page
|
assert ">30<" not in page
|
||||||
|
|
||||||
|
|
||||||
|
def test_a_month_with_nothing_in_it_says_so_and_still_draws_its_days(
|
||||||
|
client, superadmin_id, sign_in, quiet_gitea):
|
||||||
|
"""On a phone the month is a column of days rather than a grid, so an empty
|
||||||
|
month is thirty-one empty rows — which is how you see that it is empty. The
|
||||||
|
line above them says it in words, as the public agenda does.
|
||||||
|
|
||||||
|
The HTML has always been right here; what shipped was a stylesheet that hid
|
||||||
|
every day and kept the cells belonging to the neighbouring months, so the
|
||||||
|
page was six hundred pixels of nothing. The rule that catches that one is in
|
||||||
|
test_templates.py, where it can be seen.
|
||||||
|
"""
|
||||||
|
sign_in(superadmin_id)
|
||||||
|
page = client.get("/comunidad/calendario?mes=2026-12").get_data(as_text=True)
|
||||||
|
|
||||||
|
assert "No hay nada en diciembre 2026." in page
|
||||||
|
assert page.count('class="cal__day') == 31
|
||||||
|
|
||||||
|
|
||||||
|
def test_a_month_with_something_in_it_does_not_claim_to_be_empty(
|
||||||
|
client, an_event, superadmin_id, sign_in):
|
||||||
|
an_event("Asamblea", "2026-10-24")
|
||||||
|
sign_in(superadmin_id)
|
||||||
|
|
||||||
|
page = client.get("/comunidad/calendario?mes=2026-10").get_data(as_text=True)
|
||||||
|
|
||||||
|
assert "No hay nada" not in page
|
||||||
|
assert "Asamblea" in page
|
||||||
|
|
||||||
|
|
||||||
|
def test_every_day_carries_its_weekday_for_the_phone(
|
||||||
|
client, superadmin_id, sign_in, quiet_gitea):
|
||||||
|
"""The column header is hidden at phone width, so without this a day is a
|
||||||
|
bare number in a list. It comes from the loop position rather than from a
|
||||||
|
date calculation, which is why this checks the pairing and not the markup:
|
||||||
|
an off-by-one would put Sunday's name on Monday's row."""
|
||||||
|
sign_in(superadmin_id)
|
||||||
|
page = client.get("/comunidad/calendario?mes=2026-10").get_data(as_text=True)
|
||||||
|
|
||||||
|
assert page.count('class="cal__weekday"') == 31
|
||||||
|
# 1 October 2026 is a Thursday, and the grid starts on Monday.
|
||||||
|
assert re.search(r'cal__weekday">jue</span>\s*<span class="cal__number">1</span>',
|
||||||
|
page)
|
||||||
|
assert re.search(r'cal__weekday">dom</span>\s*<span class="cal__number">4</span>',
|
||||||
|
page)
|
||||||
|
|
||||||
|
|
||||||
# --- what the git server does to this ------------------------------------
|
# --- what the git server does to this ------------------------------------
|
||||||
|
|
||||||
def test_the_private_events_survive_a_git_server_that_is_down(
|
def test_the_private_events_survive_a_git_server_that_is_down(
|
||||||
|
|||||||
@ -211,8 +211,8 @@ def test_the_form_rule_is_an_exclusion_and_not_a_list_of_accepted_types():
|
|||||||
|
|
||||||
# --- the theme's own chrome -----------------------------------------------
|
# --- the theme's own chrome -----------------------------------------------
|
||||||
#
|
#
|
||||||
# These two read the Hugo theme rather than the members area, which no other
|
# These read the Hugo theme rather than the members area, which no other test
|
||||||
# test here does. They are here because the bug they guard against is this
|
# here does. They are here because the bug they guard against is this
|
||||||
# suite's recurring shape — CSS that expects markup nobody wrote — and because
|
# suite's recurring shape — CSS that expects markup nobody wrote — and because
|
||||||
# pytest is the only thing in this repository that runs on every commit.
|
# pytest is the only thing in this repository that runs on every commit.
|
||||||
|
|
||||||
@ -252,3 +252,139 @@ def test_the_way_into_the_members_area_is_in_the_bar_itself():
|
|||||||
header = (THEME / "layouts" / "partials" / "header.html").read_text(encoding="utf-8")
|
header = (THEME / "layouts" / "partials" / "header.html").read_text(encoding="utf-8")
|
||||||
bar = header.split('<nav class="site-bar__pages"')[0]
|
bar = header.split('<nav class="site-bar__pages"')[0]
|
||||||
assert "site-bar__cta" in bar and "/comunidad/" in bar
|
assert "site-bar__cta" in bar and "/comunidad/" in bar
|
||||||
|
|
||||||
|
|
||||||
|
# --- the calendar on a phone ----------------------------------------------
|
||||||
|
#
|
||||||
|
# A stylesheet guard, like the form rule above, and for the same reason: the
|
||||||
|
# bug it is about produced correct HTML and a blank page, so no request-level
|
||||||
|
# test in this suite could ever have seen it.
|
||||||
|
|
||||||
|
CALENDAR_PHONE_BLOCK = re.compile(
|
||||||
|
r"@media \(max-width: 640px\) \{(?P<body>(?:[^{}]|\{[^{}]*\})*?\.cal(?:[^{}]|\{[^{}]*\})*?)\n\}",
|
||||||
|
re.DOTALL)
|
||||||
|
RULE = re.compile(r"(?P<selectors>[^{}]+)\{(?P<body>[^{}]*)\}")
|
||||||
|
|
||||||
|
|
||||||
|
def _specificity(selector):
|
||||||
|
"""(ids, classes, elements) for one selector, near enough for this guard.
|
||||||
|
|
||||||
|
`:not()` and `:has()` contribute their own contents, which is how the
|
||||||
|
cascade actually counts them.
|
||||||
|
"""
|
||||||
|
inner = re.sub(r":(?:not|has|is)\(", " ", selector).replace(")", " ")
|
||||||
|
ids = len(re.findall(r"#[\w-]+", inner))
|
||||||
|
classes = (len(re.findall(r"\.[\w-]+", inner))
|
||||||
|
+ len(re.findall(r"\[[^\]]+\]", inner))
|
||||||
|
+ len(re.findall(r"(?<!:):[a-z-]+", inner)))
|
||||||
|
elements = len(re.findall(r"(?:^|[\s>+~])([a-z]+)(?![\w-]*\()", inner))
|
||||||
|
return ids, classes, elements
|
||||||
|
|
||||||
|
|
||||||
|
def _winning_display(rules, ending_in):
|
||||||
|
"""What `display` an element whose last compound is `ending_in` ends up with.
|
||||||
|
|
||||||
|
Only the rules whose own last compound could match it are considered, which
|
||||||
|
is all this guard needs: the question is which of two neighbouring rules
|
||||||
|
wins, not whether the ancestors line up.
|
||||||
|
"""
|
||||||
|
winner = None
|
||||||
|
for order, (selector, body) in enumerate(rules):
|
||||||
|
# The pseudo-classes come off before comparing but stay in the
|
||||||
|
# specificity: `.cal__day:not(:has(.cal__event))` is a rule about a day
|
||||||
|
# cell, and it is the one that hid every day on a phone.
|
||||||
|
last = re.sub(r":[\w-]+(\([^()]*(?:\([^()]*\))?[^()]*\))?", "",
|
||||||
|
selector.strip().split()[-1])
|
||||||
|
if last not in ending_in:
|
||||||
|
continue
|
||||||
|
display = re.search(r"display\s*:\s*([\w-]+)", body)
|
||||||
|
if not display:
|
||||||
|
continue
|
||||||
|
key = (_specificity(selector), order)
|
||||||
|
if winner is None or key > winner[0]:
|
||||||
|
winner = (key, selector.strip(), display.group(1))
|
||||||
|
return winner
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture(scope="module")
|
||||||
|
def calendar_phone_rules():
|
||||||
|
css = (Path(__file__).resolve().parents[1] / "static" / "board.css").read_text(encoding="utf-8")
|
||||||
|
block = CALENDAR_PHONE_BLOCK.search(css)
|
||||||
|
assert block, "board.css has no phone block for the calendar"
|
||||||
|
body = re.sub(r"/\*.*?\*/", "", block.group("body"), flags=re.DOTALL)
|
||||||
|
rules = []
|
||||||
|
for rule in RULE.finditer(body):
|
||||||
|
for selector in rule.group("selectors").split(","):
|
||||||
|
if selector.strip():
|
||||||
|
rules.append((selector.strip(), rule.group("body")))
|
||||||
|
return rules
|
||||||
|
|
||||||
|
|
||||||
|
def test_the_padding_cells_are_actually_hidden_on_a_phone(calendar_phone_rules):
|
||||||
|
"""The one that shipped: `.cal td { display: block }` is (0,1,1) and
|
||||||
|
`.cal__pad { display: none }` is (0,1,0), so the padding cells stayed as
|
||||||
|
92px empty boxes — while `.cal__day:not(:has(.cal__event))` at (0,2,0) won
|
||||||
|
and hid every real day. A month with no events drew four blank boxes and
|
||||||
|
nothing else, and the HTML was correct throughout.
|
||||||
|
"""
|
||||||
|
winner = _winning_display(calendar_phone_rules, {"td.cal__pad", ".cal__pad", "td"})
|
||||||
|
assert winner, "nothing in the phone block decides what a padding cell does"
|
||||||
|
assert winner[2] == "none", (
|
||||||
|
f"a padding cell ends up `display: {winner[2]}` from `{winner[1]}`. "
|
||||||
|
"A rule naming td outranks one naming only the class, so every cell "
|
||||||
|
"belonging to the neighbouring month is drawn as an empty box."
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def test_every_day_of_the_month_is_drawn_on_a_phone(calendar_phone_rules):
|
||||||
|
"""The month is a column of days there, not only the days with something in
|
||||||
|
them: an empty day is how you see the month is empty, and how an admin taps
|
||||||
|
the 14th to put something on it."""
|
||||||
|
winner = _winning_display(calendar_phone_rules, {"td.cal__day", ".cal__day"})
|
||||||
|
assert winner and winner[2] != "none", (
|
||||||
|
f"a day cell ends up hidden on a phone (`{winner[1] if winner else '—'}`)."
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def test_the_weekday_shows_on_a_phone(calendar_phone_rules):
|
||||||
|
"""The header row is hidden at that width, and the base stylesheet hides
|
||||||
|
`.cal__weekday` because up there the header says it. If the phone block
|
||||||
|
only restyles it without turning it back on, every row of the month reads
|
||||||
|
as a bare number — which is how it was first rendered."""
|
||||||
|
winner = _winning_display(calendar_phone_rules, {".cal__weekday", "span.cal__weekday"})
|
||||||
|
assert winner and winner[2] != "none", (
|
||||||
|
"the phone block never gives .cal__weekday a display of its own, so the "
|
||||||
|
"base `display: none` stands and the days lose their weekday."
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
AGENDA_PHONE_BLOCK = re.compile(
|
||||||
|
r"@media \(max-width: 640px\) \{(?P<body>(?:[^{}]|\{[^{}]*\})*?\.agenda__(?:[^{}]|\{[^{}]*\})*?)\n\}",
|
||||||
|
re.DOTALL)
|
||||||
|
|
||||||
|
|
||||||
|
def test_the_public_agenda_draws_every_day_on_a_phone_too():
|
||||||
|
"""The same rule as the members area's calendar, in the other stylesheet.
|
||||||
|
|
||||||
|
The two are one feature seen from two sides — the private calendar lists
|
||||||
|
the public events — so a member who moves between them should not meet two
|
||||||
|
designs. The agenda used to show only the days with something in them,
|
||||||
|
which made an empty month a heading and one sentence.
|
||||||
|
"""
|
||||||
|
css = (THEME / "assets" / "css" / "main.css").read_text(encoding="utf-8")
|
||||||
|
block = AGENDA_PHONE_BLOCK.search(css)
|
||||||
|
assert block, "main.css has no phone block for the agenda"
|
||||||
|
body = re.sub(r"/\*.*?\*/", "", block.group("body"), flags=re.DOTALL)
|
||||||
|
rules = [(selector.strip(), rule.group("body"))
|
||||||
|
for rule in RULE.finditer(body)
|
||||||
|
for selector in rule.group("selectors").split(",") if selector.strip()]
|
||||||
|
|
||||||
|
day = _winning_display(rules, {".agenda__day", "li.agenda__day"})
|
||||||
|
assert day and day[2] != "none", (
|
||||||
|
f"a day of the month is hidden on a phone (`{day[1] if day else '—'}`)")
|
||||||
|
pad = _winning_display(rules, {".agenda__pad", "li.agenda__pad"})
|
||||||
|
assert pad and pad[2] == "none", "the neighbouring months' padding cells are drawn"
|
||||||
|
weekday = _winning_display(rules, {".agenda__weekday", "span.agenda__weekday"})
|
||||||
|
assert weekday and weekday[2] != "none", (
|
||||||
|
"the phone block never shows .agenda__weekday, so every row of the "
|
||||||
|
"month is a bare number — there is no column header at that width")
|
||||||
|
|||||||
@ -1193,6 +1193,36 @@ In the members area the navigation **wraps** on a phone rather than scrolling:
|
|||||||
six sections over two lines shows all six, where a swipe strip would have left
|
six sections over two lines shows all six, where a swipe strip would have left
|
||||||
Calendario and Gestión off the right edge with nothing to say they were there.
|
Calendario and Gestión off the right edge with nothing to say they were there.
|
||||||
|
|
||||||
|
**Both calendars become a column of days below 640px** — every day of the month,
|
||||||
|
in order, with its weekday beside it, the days carrying something standing out,
|
||||||
|
and a line saying so when the month is empty. The private one
|
||||||
|
(`/comunidad/calendario`, a `<table>`) and the public agenda (`/page/agenda/`,
|
||||||
|
an `<ol>`) are deliberately the same shape, because the private one lists the
|
||||||
|
public events and a member moves between the two.
|
||||||
|
|
||||||
|
Both phone blocks are written so that **every rule deciding `display` names the
|
||||||
|
cell's own class**, and `apps/board/tests/test_templates.py` fails if one does
|
||||||
|
not. That is the shape of the bug it replaces: the calendar's block opened with
|
||||||
|
`.cal td { display: block }` — specificity (0,1,1) — which outranked
|
||||||
|
`.cal__pad { display: none }` at (0,1,0), while `.cal__day:not(:has(…))` at
|
||||||
|
(0,2,0) won and hid every real day. A month with no events therefore drew four
|
||||||
|
empty boxes and nothing else, with correct HTML throughout. The guard computes
|
||||||
|
the specificity and runs the cascade for a padding cell, a day cell and the
|
||||||
|
weekday label, which is as close as pytest gets to looking at a page.
|
||||||
|
|
||||||
|
**Tap targets are raised under `@media (pointer: coarse)`** in both stylesheets,
|
||||||
|
and both blocks are **padding only** — no type size, colour or spacing changes,
|
||||||
|
so the desktop is untouched. The numbers were measured in a headless browser
|
||||||
|
rather than guessed: the members-area navigation links were 37×17, the
|
||||||
|
calendar's `+` was 7×15, the footer links 16px tall. A link inside a sentence is
|
||||||
|
deliberately left alone; a 44px line box mid-paragraph overlaps the lines around
|
||||||
|
it, which is why WCAG exempts one.
|
||||||
|
|
||||||
|
The theme's coarse block sits at the **end** of `main.css` on purpose:
|
||||||
|
`.site-bar__cta` takes its phone padding inside the `max-width: 768px` block, a
|
||||||
|
media query changes nothing about specificity, and a coarse rule written before
|
||||||
|
it loses silently.
|
||||||
|
|
||||||
### 11.20 The three admin tools
|
### 11.20 The three admin tools
|
||||||
|
|
||||||
**Estado del sistema** (superadministrator). The backups panel reads
|
**Estado del sistema** (superadministrator). The backups panel reads
|
||||||
|
|||||||
@ -3805,10 +3805,18 @@ a.notif-card__message:hover {
|
|||||||
.cal-event-item__title { font-size: 1.02rem; }
|
.cal-event-item__title { font-size: 1.02rem; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Site bar: prevent overflow on very narrow screens */
|
/* Site bar: prevent overflow on very narrow screens.
|
||||||
|
*
|
||||||
|
* The ☰ ran off the right edge of a 320px screen on the Portuguese home page
|
||||||
|
* and nowhere else, because «Comunidade» is three letters longer than
|
||||||
|
* «Comunidad» and the bar had no room left to give. A layout that depends on
|
||||||
|
* how long a word is in one of three languages breaks in the language nobody
|
||||||
|
* tests in, so the gap and the button both give way here. */
|
||||||
@media (max-width: 360px) {
|
@media (max-width: 360px) {
|
||||||
.site-bar__inner { padding: 8px 12px; }
|
.site-bar__inner { padding: 8px 12px; gap: 8px; }
|
||||||
.site-bar__btn { padding: 7px 12px; font-size: 0.82rem; }
|
.site-bar__btn { padding: 7px 12px; font-size: 0.82rem; }
|
||||||
|
.site-bar__brand-text { font-size: 1rem; min-width: 0; }
|
||||||
|
.site-bar__cta { padding-left: 10px; padding-right: 10px; font-size: 0.75rem; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --- preguntas frecuentes ---------------------------------------------- */
|
/* --- preguntas frecuentes ---------------------------------------------- */
|
||||||
@ -4018,6 +4026,11 @@ a.notif-card__message:hover {
|
|||||||
}
|
}
|
||||||
.agenda__pad { background: transparent; border-color: transparent; }
|
.agenda__pad { background: transparent; border-color: transparent; }
|
||||||
.agenda__number { color: var(--subtle, #9a7870); font-weight: 700; }
|
.agenda__number { color: var(--subtle, #9a7870); font-weight: 700; }
|
||||||
|
/* The column a day sits in is its weekday here, so naming it would be saying
|
||||||
|
the same thing twice. The phone block below, where the month is a column of
|
||||||
|
days and a column position means nothing, is the only place it shows. */
|
||||||
|
.agenda__weekday { display: none; }
|
||||||
|
.agenda__events { display: block; }
|
||||||
.agenda__day--busy { background: var(--brand-softer, #fdf1ed); border-color: var(--brand-soft, #fbe2db); }
|
.agenda__day--busy { background: var(--brand-softer, #fdf1ed); border-color: var(--brand-soft, #fbe2db); }
|
||||||
|
|
||||||
.agenda__event {
|
.agenda__event {
|
||||||
@ -4032,14 +4045,26 @@ a.notif-card__message:hover {
|
|||||||
|
|
||||||
.agenda__empty { text-align: center; margin: -12px 0 24px; }
|
.agenda__empty { text-align: center; margin: -12px 0 24px; }
|
||||||
|
|
||||||
/* A seven-column grid on a phone is seven columns of nothing. Below 640px the
|
/* A seven-column grid on a phone is seven columns of nothing, so below 640px
|
||||||
month becomes a list of the days that have something in them. */
|
the month becomes a column: every day, in order, with its weekday beside it
|
||||||
|
and the days that have something in them standing out.
|
||||||
|
It used to show only the busy days, which made an empty month a heading and
|
||||||
|
a sentence — and this is the shape the members area's calendar now has too,
|
||||||
|
because a member who moves between the two should not meet two designs. */
|
||||||
@media (max-width: 640px) {
|
@media (max-width: 640px) {
|
||||||
.agenda__grid { display: block; }
|
.agenda__grid { display: block; }
|
||||||
.agenda__pad { display: none; }
|
.agenda__pad { display: none; }
|
||||||
.agenda__day { display: none; min-height: 0; margin-bottom: 6px; }
|
.agenda__day {
|
||||||
.agenda__day--busy { display: block; }
|
display: flex;
|
||||||
.agenda__number { display: inline-block; margin-right: 8px; }
|
align-items: baseline;
|
||||||
|
gap: 10px;
|
||||||
|
min-height: 44px;
|
||||||
|
margin-bottom: 6px;
|
||||||
|
}
|
||||||
|
.agenda__date { flex: 0 0 4.2rem; } /* the dates line up down the page */
|
||||||
|
.agenda__weekday { display: inline; }
|
||||||
|
.agenda__events { flex: 1; min-width: 0; }
|
||||||
|
.agenda__number { display: inline-block; margin-left: 4px; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The association's accounts elsewhere, in the footer. Set in
|
/* The association's accounts elsewhere, in the footer. Set in
|
||||||
@ -4052,3 +4077,28 @@ a.notif-card__message:hover {
|
|||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
font-size: 0.85rem;
|
font-size: 0.85rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* --- a thumb is not a mouse ---------------------------------------------
|
||||||
|
*
|
||||||
|
* Controls raised to 44px where the pointer is coarse — a touchscreen, not a
|
||||||
|
* narrow window, so a phone in landscape gets it too. Padding only: no type
|
||||||
|
* size, colour or spacing changes, and the desktop is untouched.
|
||||||
|
*
|
||||||
|
* At the end of the file on purpose. `.site-bar__cta` is given its phone
|
||||||
|
* padding inside the max-width: 768px block further up, and a media query
|
||||||
|
* changes nothing about specificity — so a coarse rule written before it
|
||||||
|
* loses, silently, and the button stays 33px tall. Every number here is what
|
||||||
|
* that control's own line box needs, measured in a browser.
|
||||||
|
*
|
||||||
|
* Links inside a paragraph are left alone deliberately. A 44px line box
|
||||||
|
* mid-sentence overlaps the lines around it, which is why WCAG exempts a link
|
||||||
|
* that is part of a line of text.
|
||||||
|
*/
|
||||||
|
@media (pointer: coarse) {
|
||||||
|
.site-bar__cta { padding-top: 15px; padding-bottom: 15px; }
|
||||||
|
.site-bar__hamburger { min-width: 44px; min-height: 44px; }
|
||||||
|
.page-nav a { display: inline-block; padding: 14px 0; }
|
||||||
|
.site-foot a { display: inline-block; padding: 15px 0; }
|
||||||
|
.back-link { display: inline-block; padding: 14px 0; }
|
||||||
|
.agenda__move { min-width: 44px; min-height: 44px; }
|
||||||
|
}
|
||||||
|
|||||||
@ -80,13 +80,23 @@
|
|||||||
{{ range $day := seq 1 $days }}
|
{{ range $day := seq 1 $days }}
|
||||||
{{ $date := printf "%s-%02d" $key $day }}
|
{{ $date := printf "%s-%02d" $key $day }}
|
||||||
{{ $onThisDay := where $events "Params.event_date" $date }}
|
{{ $onThisDay := where $events "Params.event_date" $date }}
|
||||||
|
{{/* The column a day falls in is its weekday, Monday first — the
|
||||||
|
same arithmetic the padding above is made of. On a phone the
|
||||||
|
grid becomes one day per row, where a column position says
|
||||||
|
nothing and the name has to be written out. */}}
|
||||||
|
{{ $weekday := mod (add (sub $day 1) $lead) 7 }}
|
||||||
<li class="agenda__day {{ if $onThisDay }}agenda__day--busy{{ end }}">
|
<li class="agenda__day {{ if $onThisDay }}agenda__day--busy{{ end }}">
|
||||||
|
<span class="agenda__date">
|
||||||
|
<span class="agenda__weekday">{{ partial "weekday-name.html" (dict "weekday" $weekday "lang" $lang) }}</span>
|
||||||
<span class="agenda__number">{{ $day }}</span>
|
<span class="agenda__number">{{ $day }}</span>
|
||||||
|
</span>
|
||||||
|
<span class="agenda__events">
|
||||||
{{ range $onThisDay }}
|
{{ range $onThisDay }}
|
||||||
<a class="agenda__event" href="{{ .RelPermalink }}">
|
<a class="agenda__event" href="{{ .RelPermalink }}">
|
||||||
{{ with .Params.event_time }}<time>{{ . }}</time> {{ end }}{{ .Title }}
|
{{ with .Params.event_time }}<time>{{ . }}</time> {{ end }}{{ .Title }}
|
||||||
</a>
|
</a>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
</span>
|
||||||
</li>
|
</li>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</ol>
|
</ol>
|
||||||
|
|||||||
15
themes/vienalatina/layouts/partials/weekday-name.html
Normal file
15
themes/vienalatina/layouts/partials/weekday-name.html
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{{- /* The weekday, abbreviated, in the page's own language.
|
||||||
|
|
||||||
|
Same arrangement as month-name.html and for the same reason: this theme
|
||||||
|
ships no i18n files, and three languages of seven short words is a table
|
||||||
|
rather than a dependency.
|
||||||
|
|
||||||
|
Monday is 0, as in the agenda's own column order — Austria and most of
|
||||||
|
Latin America start the week there. */ -}}
|
||||||
|
{{- $names := dict
|
||||||
|
"es" (slice "lun" "mar" "mié" "jue" "vie" "sáb" "dom")
|
||||||
|
"de" (slice "Mo" "Di" "Mi" "Do" "Fr" "Sa" "So")
|
||||||
|
"pt-br" (slice "seg" "ter" "qua" "qui" "sex" "sáb" "dom")
|
||||||
|
-}}
|
||||||
|
{{- $table := index $names .lang | default (index $names "es") -}}
|
||||||
|
{{- index $table (int .weekday) -}}
|
||||||
Loading…
Reference in New Issue
Block a user