diff --git a/apps/board/tests/test_templates.py b/apps/board/tests/test_templates.py
index ca13705..d1480e8 100644
--- a/apps/board/tests/test_templates.py
+++ b/apps/board/tests/test_templates.py
@@ -423,31 +423,92 @@ AGENDA_PHONE_BLOCK = re.compile(
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.
+@pytest.fixture(scope="module")
+def main_css():
+ return (THEME / "assets" / "css" / "main.css").read_text(encoding="utf-8")
+
+
+@pytest.fixture(scope="module")
+def agenda_phone_rules(main_css):
+ block = AGENDA_PHONE_BLOCK.search(main_css)
+ assert block, "main.css has no phone block for the agenda"
+ return _rules_in(block.group("body"))
+
+
+@pytest.fixture(scope="module")
+def agenda_base_rules(main_css):
+ start = main_css.index(".agenda__intro")
+ end = main_css.index("@media", start)
+ return _rules_in(main_css[start:end])
+
+
+def test_the_public_agenda_is_a_month_at_every_width_too(agenda_base_rules,
+ agenda_phone_rules):
+ """The same contract as the members area's calendar, in the other
+ stylesheet, and the same three assertions.
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.
+ designs. Both used to become a column of dates below 640px, and both were
+ reported as broken for it.
"""
- 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()]
+ columns = [re.search(r"grid-template-columns\s*:\s*([^;]+)", body).group(1)
+ for selector, body in agenda_base_rules
+ if selector.endswith(".agenda__grid") and "grid-template-columns" in body]
+ assert columns, "the base stylesheet never gives .agenda__grid its columns"
+ assert "repeat(7," in columns[0].replace(" ", ""), (
+ f"the month is laid out as `{columns[0].strip()}` rather than seven columns")
- 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")
+ for selector, body in agenda_phone_rules:
+ if not selector.endswith(".agenda__grid"):
+ continue
+ display = re.search(r"display\s*:\s*([\w-]+)", body)
+ assert not display or display.group(1) == "grid", (
+ f"`{selector}` takes the month off the grid on a phone "
+ f"(`display: {display.group(1)}`), which is how it became a list "
+ "of dates the first time.")
+ assert "grid-template-columns" not in body, (
+ f"`{selector}` changes the number of columns on a phone; a month "
+ "has seven of them at every width.")
+
+
+def test_no_cell_of_the_public_month_is_hidden_on_a_phone(agenda_phone_rules):
+ """Days and padding cells alike — hide the pads and every date lands on the
+ wrong column, which still looks like a calendar."""
+ for compounds, what in (({"li.agenda__day", ".agenda__day"}, "a day"),
+ ({"li.agenda__pad", ".agenda__pad"}, "a padding cell")):
+ winner = _winning_display(agenda_phone_rules, compounds)
+ assert winner is None or winner[2] != "none", (
+ f"{what} ends up hidden on a phone, from `{winner[1]}`.")
+
+
+def test_the_public_weekday_is_hidden_from_the_eye_and_not_from_a_screen_reader(
+ agenda_base_rules):
+ rules = [(selector, body) for selector, body in agenda_base_rules
+ if selector.strip().endswith(".agenda__weekday")]
+ assert rules, "nothing in main.css hides .agenda__weekday from the eye"
+ for selector, body in rules:
+ display = re.search(r"display\s*:\s*([\w-]+)", body)
+ assert not display or display.group(1) != "none", (
+ f"`{selector}` uses display:none, which hides the weekday from a "
+ "screen reader as well. Clip it instead.")
+ assert any("clip-path" in body for _, body in rules), (
+ "the weekday is not clipped, so it is drawn inside every cell")
+
+
+def test_the_agenda_always_has_a_year_ahead_to_look_at(main_css):
+ """Not CSS: the span the layout builds.
+
+ The months rendered used to run from the earliest event to the latest, so
+ the agenda stopped dead at the last month anybody had announced something
+ in — December went grey on the → and January could not be reached. An empty
+ month has to be visitable, or an agenda with nothing coming up reads as
+ broken rather than as empty.
+ """
+ layout = (THEME / "layouts" / "page" / "agenda.html").read_text(encoding="utf-8")
+ assert "now.AddDate 0 11 0" in layout, (
+ "the agenda's span is not extended past the last event, so the last "
+ "month with something in it is the last month anybody can reach")
# --- the share row, which is theme and not members area --------------------
diff --git a/docs/server-setup.md b/docs/server-setup.md
index af7d516..2c9ddd7 100644
--- a/docs/server-setup.md
+++ b/docs/server-setup.md
@@ -1484,13 +1484,31 @@ 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
Calendario and Gestión off the right edge with nothing to say they were there.
-**The private calendar is a seven-column month at every width.** Below 640px
-the cells shrink to about 50px, the titles come out of them and each day with
-something in it shows one dot per event and links to that day's block in a list
-under the grid — an anchor, so it needs no script. Above 640px the titles are
-in the cells and the list is not drawn. The padding cells belonging to the
-neighbouring months keep their space at both widths: they are what puts the 1st
-under its own weekday.
+**Both calendars are a seven-column month at every width** — the private one at
+`/comunidad/calendario` and the public agenda at `/page/agenda/`. They are one
+feature seen from two sides, since the private one lists the public events, so
+they have the same shape on purpose and the guards in
+`apps/board/tests/test_templates.py` are written twice, once per stylesheet.
+
+**The agenda always renders a year ahead**, whatever the events say: this month
+and the eleven after it, plus every month that has something in it. Without
+that the span ran from the first event to the last, so the → went grey on the
+last month anybody had announced something in and the next one could not be
+reached — which reads as broken rather than as empty. A month with nothing in
+it says so.
+
+That change also surfaced a bug that had been sitting in the layout since it
+was written: `int "08"` is an error in Go, because a leading zero means octal
+and 8 is not an octal digit. The month number is taken off the parsed date now
+(`$asTime.Format "1"`) rather than off the key string. It had never fired
+because August and September had never been inside the span.
+
+**Below 640px**, in both of them, the cells shrink to about 50px, the titles
+come out of them, and each day with something in it shows one dot per event and
+links to that day's block in a list under the grid — an anchor, so it needs no
+script. Above 640px the titles are in the cells and the list is not drawn. The
+padding cells belonging to the neighbouring months keep their space at both
+widths: they are what puts the 1st under its own weekday.
The weekday inside each cell is **clipped rather than `display: none`**, because
the header row says it to anyone who can see it and a screen reader still needs
@@ -1503,10 +1521,17 @@ an element to undo them — and `.cal td` at specificity (0,1,1) outranks
as 92px empty boxes while `.cal__day:not(:has(…))` at (0,2,0) won and hid every
real day, so a month with nothing in it drew four empty boxes and nothing else
— with correct HTML throughout. A grid has no scaffolding to undo, which is why
-the public agenda (`/page/agenda/`, an `
` since it was written) never had
-the bug. `apps/board/tests/test_templates.py` computes specificity and runs the
-cascade for a day cell, a padding cell and the grid itself, which is as close as
-pytest gets to looking at a page.
+the agenda, an `` since it was written, never had *that* bug even while it
+had the other one. `apps/board/tests/test_templates.py` computes specificity
+and runs the cascade for a day cell, a padding cell and the grid itself, in
+both stylesheets, which is as close as pytest gets to looking at a page.
+
+**Neither of these was caught by a test, and neither could have been.** Both
+were a stylesheet turning correct HTML into something unreadable, and the loop
+that finds that is rendering the page in a headless browser at 320, 390 and
+1280 and measuring it — `grid-template-columns` still seven, every day cell
+with a height, nothing past the right edge. The guards above are the cheap
+half; the render is the half that actually looks.
**A pasted link breaks rather than leaving its box.** `profiles.clean_links`
accepts a 500-character label and a URL is one word, so `.prose`,
diff --git a/themes/vienalatina/assets/css/main.css b/themes/vienalatina/assets/css/main.css
index 848e4a4..4bd258d 100644
--- a/themes/vienalatina/assets/css/main.css
+++ b/themes/vienalatina/assets/css/main.css
@@ -4035,7 +4035,7 @@ a.notif-card__message:hover {
.has-agenda-script .agenda__bar { display: flex; }
.has-agenda-script .agenda__heading { display: none; }
-.agenda__grid {
+.agenda__head, .agenda__grid {
display: grid;
grid-template-columns: repeat(7, 1fr);
gap: 4px;
@@ -4043,8 +4043,18 @@ a.notif-card__message:hover {
margin: 0 0 24px;
padding: 0;
}
+.agenda__head {
+ margin-bottom: 4px;
+ font-size: 0.72rem;
+ text-transform: uppercase;
+ letter-spacing: 0.04em;
+ color: var(--muted, #5c3d37);
+}
.agenda__day, .agenda__pad {
+ /* The day's link is laid over the whole cell on a phone, which is what makes
+ the cell the tap target rather than six pixels of dot. */
+ position: relative;
min-height: 92px;
padding: 6px;
border: 1px solid var(--border-light, #e0cec8);
@@ -4054,11 +4064,24 @@ a.notif-card__message:hover {
}
.agenda__pad { background: transparent; border-color: transparent; }
.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; }
+/* The header row says the weekday at every width, so the copy inside each cell
+ is for a screen reader rather than for the eye — it is what makes «22»
+ announce itself as a Thursday. Clipped rather than `display: none`, which
+ would take it out of the accessibility tree as well. */
+.agenda__weekday {
+ position: absolute;
+ width: 1px;
+ height: 1px;
+ margin: -1px;
+ padding: 0;
+ overflow: hidden;
+ clip-path: inset(50%);
+ white-space: nowrap;
+}
.agenda__events { display: block; }
+/* Both of these are the phone's half of the month, and are drawn there. */
+.agenda__dots { display: none; }
+.agenda__list { display: none; }
.agenda__day--busy { background: var(--brand-softer, #fdf1ed); border-color: var(--brand-soft, #fbe2db); }
.agenda__event {
@@ -4067,32 +4090,58 @@ a.notif-card__message:hover {
color: var(--brand-dark, #9a2a0f);
text-decoration: none;
line-height: 1.3;
+ /* A title holding a URL is one unbreakable word; without this it leaves the
+ cell sideways. */
+ overflow-wrap: anywhere;
}
.agenda__event time { font-weight: 700; }
.agenda__event:hover { text-decoration: underline; }
.agenda__empty { text-align: center; margin: -12px 0 24px; }
-/* A seven-column grid on a phone is seven columns of nothing, so below 640px
- 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. */
+/* Still seven columns: a month that is not a grid is a list of dates, and a
+ list of dates is what this used to turn into below 640px. What changes is
+ what fits in a fifty-pixel cell — the number and a dot per event — with the
+ titles in a list underneath that each busy cell links to.
+ The members area's calendar has exactly this shape, deliberately: a member
+ moves between the two and should not meet two designs. */
@media (max-width: 640px) {
- .agenda__grid { display: block; }
- .agenda__pad { display: none; }
- .agenda__day {
+ .agenda__head, .agenda__grid { gap: 2px; }
+ .agenda__head { font-size: 0.6rem; letter-spacing: 0; text-align: center; }
+ .agenda__day, .agenda__pad { min-height: 54px; padding: 4px; }
+ .agenda__date { text-align: center; }
+ .agenda__number { display: block; }
+ .agenda__events { display: none; }
+ /* Laid over the whole cell, so tapping anywhere on the 24th — the number
+ included — goes to the 24th. */
+ .agenda__dots {
+ position: absolute;
+ inset: 0;
display: flex;
- align-items: baseline;
- gap: 10px;
- min-height: 44px;
- margin-bottom: 6px;
+ flex-wrap: wrap;
+ justify-content: center;
+ align-content: flex-end;
+ gap: 2px;
+ padding: 0 2px 4px;
}
- .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; }
+ .agenda__dot {
+ width: 6px;
+ height: 6px;
+ border-radius: 50%;
+ background: var(--brand, #c0391c);
+ }
+ .agenda__list { display: block; margin-bottom: 24px; }
+ .agenda__listday { margin-bottom: 16px; }
+ .agenda__listhead {
+ margin: 0 0 4px;
+ font-size: 0.85rem;
+ text-transform: uppercase;
+ letter-spacing: 0.04em;
+ color: var(--muted, #5c3d37);
+ }
+ /* One line of text is a 21px target, and these are the links the dots exist
+ to lead to. */
+ .agenda__list .agenda__event { padding: 12px 0; margin-top: 0; }
}
/* The association's accounts elsewhere, in the footer. Set in
diff --git a/themes/vienalatina/layouts/page/agenda.html b/themes/vienalatina/layouts/page/agenda.html
index 6fc7c7c..d2f4587 100644
--- a/themes/vienalatina/layouts/page/agenda.html
+++ b/themes/vienalatina/layouts/page/agenda.html
@@ -1,33 +1,35 @@
{{/* The public agenda: one grid per month, all of them built here.
- Every month between the first event and the last is rendered, plus the
- current one, and assets/js/agenda.js shows one at a time. Two things fall
- out of building them all rather than fetching a month at a time:
+ Every month in the span is rendered and assets/js/agenda.js shows one at a
+ time. Two things fall out of building them all rather than fetching a month
+ at a time:
* **With JavaScript off, every month is on the page**, stacked, each under
its own heading. Nothing is hidden from a reader who has no script, and
nothing is hidden from a crawler either.
* Moving between months is instant and makes no request.
- The weekday arithmetic is the awkward part, because Hugo exposes no
- AddDate: the length of a month comes from a table plus a leap-year check,
- and the weekday of the first falls out of formatting that date. It looks
- like something simpler was missed, and it is not. */}}
+ The weekday arithmetic is the awkward part: the length of a month comes
+ from a table plus a leap-year check, because there is nothing to call for
+ it. It looks like something simpler was missed, and it is not. */}}
{{ define "main" }}
{{ $lang := .Site.Language.Lang }}
{{ $events := where (where .Site.RegularPages "Section" "post") "Params.event_date" "!=" nil }}
-{{/* The span to render: from the earliest event to the latest, and always
- including the month the site was built in, so an empty agenda still shows
- the reader where they are. */}}
+{{/* The span to render. Every month that has an event, and — whatever the
+ events say — this month and the eleven after it, so there is always a year
+ ahead to look at. Without that last part the agenda stopped dead at the
+ last month anybody had announced something in: the → went grey in December
+ and January could not be reached, which reads as broken rather than as
+ empty. A month with nothing in it says so. */}}
{{ $months := slice }}
{{ range $events }}{{ $months = $months | append (substr .Params.event_date 0 7) }}{{ end }}
-{{ $months = $months | append (now.Format "2006-01") }}
+{{ $months = $months | append (now.Format "2006-01") ((now.AddDate 0 11 0).Format "2006-01") }}
{{ $months = sort (uniq $months) }}
{{ $from := index $months 0 }}
{{ $to := index $months (sub (len $months) 1) }}
-{{/* Expanded so a month with nothing in it can still be visited. */}}
+{{/* Filled in, so a month between two events can still be visited. */}}
{{ $span := slice }}
{{ range $y := seq (int (substr $from 0 4)) (int (substr $to 0 4)) }}
{{ range $m := seq 1 12 }}
@@ -52,9 +54,16 @@
{{ range $key := $span }}
- {{ $year := int (substr $key 0 4) }}
- {{ $month := int (substr $key 5 2) }}
{{ $firstDay := printf "%s-01" $key }}
+ {{/* Through the date rather than off the string: `int "08"` is an error,
+ because Go reads a leading zero as octal and 8 is not an octal digit.
+ That sat here unnoticed for as long as the span only ever ran from the
+ first event to the last — August and September were never in it. The
+ moment the agenda gained a year of empty months ahead, the build
+ stopped. `Format "1"` is the month with no padding. */}}
+ {{ $asTime := $firstDay | time.AsTime }}
+ {{ $year := $asTime.Year }}
+ {{ $month := int ($asTime.Format "1") }}
{{/* Days in the month: a table, with February decided by the leap rule —
every four years, not every hundred, except every four hundred. */}}
@@ -69,12 +78,19 @@
{{/* Monday first, as in Austria and most of Latin America. Go names the
weekday; this turns the name into a column offset. */}}
{{ $offsets := dict "Mon" 0 "Tue" 1 "Wed" 2 "Thu" 3 "Fri" 4 "Sat" 5 "Sun" 6 }}
- {{ $lead := index $offsets (($firstDay | time.AsTime).Format "Mon") }}
+ {{ $lead := index $offsets ($asTime.Format "Mon") }}
+ {{/* The column header, at every width. It is what lets the weekday
+ inside each cell be a label for a screen reader rather than ink in
+ a fifty-pixel box. */}}
+
+ {{ range $weekday := seq 0 6 }}
{{ end }}
+
+
{{ if gt $lead 0 }}{{ range seq $lead }}{{ end }}{{ end }}
{{ range $day := seq 1 $days }}
@@ -87,28 +103,46 @@
people. An event with no time sorts first here, which is right:
all day begins before the evening does. */}}
{{ $onThisDay := sort (where $events "Params.event_date" $date) "Params.event_time" }}
- {{/* 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 }}
{{ partial "weekday-name.html" (dict "weekday" $weekday "lang" $lang) }}{{ $day }}
-
- {{ range $onThisDay }}
-
- {{ with .Params.event_time }} {{ end }}{{ .Title }}
-
+ {{ with $onThisDay }}
+ {{/* A phone cell is about fifty pixels wide, which holds a
+ number and some dots and nothing else. The dots link to
+ this day's block in the list below, so the month stays a
+ month and the titles stay readable. */}}
+
+ {{ range first 4 . }}{{ end }}
+
{{ end }}
+
+ {{ range $onThisDay }}{{ partial "agenda-event.html" . }}{{ end }}
{{ end }}
{{ $inMonth := where (where $events "Params.event_date" "ge" (printf "%s-01" $key)) "Params.event_date" "le" (printf "%s-31" $key) }}
+
+ {{/* Only the days that have something in them, and only on a phone —
+ above 640px every title is already in its cell. */}}
+ {{ with $inMonth }}
+
{{ end }}
diff --git a/themes/vienalatina/layouts/partials/agenda-event.html b/themes/vienalatina/layouts/partials/agenda-event.html
new file mode 100644
index 0000000..12e49d0
--- /dev/null
+++ b/themes/vienalatina/layouts/partials/agenda-event.html
@@ -0,0 +1,5 @@
+{{/* One event, as a link. Used in the grid cell and again in the list the
+ phone shows under the month, so the two cannot drift apart. */}}
+
+ {{- with .Params.event_time }} {{ end }}{{ .Title }}
+