Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ jobs:
} | tee -a "$GITHUB_STEP_SUMMARY"

# Browser end-to-end tests (member-page "Load more"/"Load all", bio toggle,
# section nav). Kept in a SEPARATE job from `test` so the fast unit/integration
# section nav; Projects-page topic filter, #1474). Kept in a SEPARATE job from `test` so the fast unit/integration
# signal stays fast and isolated — a slow or flaky browser run doesn't muddy
# "did the logic break?". Like `test`, this is report-only (it doesn't block
# the push or the deploy). Playwright + its browser live in requirements-dev.txt
Expand Down Expand Up @@ -170,7 +170,7 @@ jobs:
run: python -m playwright install --with-deps chromium

- name: Run end-to-end tests
run: python manage.py test website.tests.test_member_e2e --settings=makeabilitylab.settings_test --verbosity=2
run: python manage.py test website.tests.test_member_e2e website.tests.test_project_listing_e2e --settings=makeabilitylab.settings_test --verbosity=2

# Accessibility sweep (Pa11y + Axe, WCAG 2.0 AA). CONTRIBUTING requires Pa11y
# on UI changes but nothing enforced it (#1278 item 6). This wires it in.
Expand Down
4 changes: 2 additions & 2 deletions makeabilitylab/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,8 @@ def parse_allowed_hosts(value, django_env):
CSRF_COOKIE_SECURE = True

# Makeability Lab Global Variables, including Makeability Lab version
ML_WEBSITE_VERSION = "2.35.5" # Keep this updated with each release and also change the short description below
ML_WEBSITE_VERSION_DESCRIPTION = "Each of the three login-throttle pages under Administration (Access attempts, logs, failures) now explains what it records and how to unlock an account."
ML_WEBSITE_VERSION = "2.35.6" # Keep this updated with each release and also change the short description below
ML_WEBSITE_VERSION_DESCRIPTION = "The Projects page topic filter has a lighter, tighter sidebar, and filtering by a topic such as Design no longer also shows projects from a topic whose name contains it."
DATE_MAKEABILITYLAB_FORMED = datetime.date(2012, 1, 1) # Date Makeability Lab was formed
MAX_BANNERS = 7 # Maximum number of banners on a page

Expand Down
164 changes: 95 additions & 69 deletions website/static/website/css/project-listing.css
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,21 @@
.section-heading {
color: var(--color-text-secondary);
font-size: var(--font-size-xl);
line-height: 22px; /* matches .filter-heading so the two hairlines meet */
font-weight: var(--font-weight-semibold);
border-bottom: 1px solid var(--color-border);
margin: var(--space-8) 0 var(--space-4) 0;
padding-bottom: var(--space-2);
}

/* The link icon (base.css: 0.7em, vertical-align: middle) would otherwise
inherit the absolute 22px line-height above; a 22px box on a 14px font,
middle-aligned, sits ~2px low and grows the line box, so the hairline
drops below .filter-head's. line-height: 1 keeps it inside the line. */
.section-heading .header-anchor {
line-height: 1;
}

/* First section heading doesn't need as much top margin */
#active-projects-section .section-heading {
margin-top: var(--space-2);
Expand All @@ -69,6 +78,16 @@

/* =============================================================================
FILTER SIDEBAR (Desktop)
-----------------------------------------------------------------------------
Direction A from the #1474 design review: plain right-aligned counts, a
tinted selected row with a left bar (not colour alone), and "Clear" in the
heading row beside "Topics". (The heading row is inside the scrolling nav,
so when the list overflows the sidebar, "Clear" scrolls away with it.)

Contrast on white (design-tokens.css values):
label #212121 16.1:1 count / heading #595959 7.0:1
Clear #0d5a8c 7.4:1 selected text #104d7a on #e8f4fc 7.9:1
hover: label 14.8:1, count 6.4:1 on #f5f5f5
============================================================================= */

.project-filter-sidebar {
Expand All @@ -77,18 +96,34 @@
top: 80px;
max-height: calc(100vh - 120px);
overflow-y: auto;
padding-right: var(--space-3);
align-self: flex-start;
/* Borrow 8px of the column gutter so the label text (5px padding + 3px
left bar) lines up with the h1's left edge. */
margin-left: -8px;
}

/* Heading row: "Topics" on the left, "Clear" on the right, with a hairline
that meets the "Active Projects" section heading's hairline. The 8px top
margin + 22px line + 8px padding matches .section-heading in the first
section. */
.filter-head {
display: flex;
align-items: baseline;
justify-content: space-between;
margin: var(--space-2) var(--space-2) var(--space-3);
padding-bottom: var(--space-2);
border-bottom: 1px solid var(--color-border);
}

.filter-heading {
font-size: var(--font-size-sm);
margin: 0;
padding: 0;
font-size: 13px;
font-weight: var(--font-weight-semibold);
color: var(--color-text-primary);
line-height: 22px;
color: var(--color-text-secondary);
text-transform: uppercase;
letter-spacing: 0.05em;
margin: 0 0 var(--space-3) 8px;
padding: 0;
letter-spacing: 0.06em;
}


Expand All @@ -103,9 +138,7 @@
}

.filter-item {
/* margin-bottom: var(--space-1); */
margin: 4px;
margin-bottom: 6px;
margin: 0;
}


Expand All @@ -115,102 +148,101 @@

.filter-btn {
display: flex;
align-items: center;
justify-content: space-between;
align-items: baseline;
gap: var(--space-2);
width: 100%;
padding: var(--space-1) var(--space-1);
padding: 5px var(--space-2) 5px 5px;
background-color: transparent;
border: 1px solid transparent;
border-radius: var(--border-radius-sm);
color: var(--color-text-secondary);
border: 0;
border-left: 3px solid transparent;
border-radius: 0 var(--border-radius-sm) var(--border-radius-sm) 0;
color: var(--color-text-primary);
font-family: var(--font-family-secondary);
font-size: var(--font-size-sm);
line-height: 20px;
text-align: left;
cursor: pointer;
transition: background-color var(--transition-fast),
border-color var(--transition-fast),
color var(--transition-fast);
}

.filter-name {
flex: 1 1 auto;
min-width: 0;
/* Topic labels are ProjectUmbrella.short_name, typed by editors; capitalize
each word so a lowercase entry ("accessibility") still reads as a label.
Only uppercases first letters, so "EdTech" and "AR" are untouched. */
text-transform: capitalize;
}

.filter-btn:hover {
background-color: var(--color-bg-surface);
color: var(--color-text-primary);
}

.filter-btn:focus {
/* :focus-visible keeps the ring off after a mouse click. The inset offset
keeps the ring from being clipped by the sidebar's overflow scroller. */
.filter-btn:focus-visible {
outline: var(--focus-ring-width) solid var(--focus-ring-color);
outline-offset: var(--focus-ring-offset);
outline-offset: -2px;
}

/* Active/pressed state */
/* Selected: tint + left bar + medium weight, so state isn't colour-only.
#104d7a on #e8f4fc = 7.9:1. */
.filter-btn[aria-pressed="true"] {
background-color: var(--color-primary);
border-color: var(--color-primary);
color: var(--color-text-on-dark);
background-color: var(--color-primary-light);
border-left-color: var(--color-primary);
color: var(--color-primary-hover);
font-weight: var(--font-weight-medium);
}

.filter-btn[aria-pressed="true"]:hover {
background-color: var(--color-primary-hover);
}

.filter-btn[aria-pressed="true"] .filter-count {
background-color: rgba(255, 255, 255, 0.2);
color: var(--color-text-on-dark);
}


/* -----------------------------------------------------------------------------
Filter Count Badge
Filter Count
----------------------------------------------------------------------------- */

.filter-count {
display: inline-flex;
align-items: center;
justify-content: center;
min-width: 24px;
height: 20px;
padding: 0 var(--space-2);
background-color: var(--color-bg-surface);
border-radius: var(--border-radius-full);
font-size: var(--font-size-xs);
font-weight: var(--font-weight-medium);
flex: none;
font-size: 13px;
font-variant-numeric: tabular-nums;
text-align: right;
color: var(--color-text-secondary);
}

.filter-btn[aria-pressed="true"] .filter-count {
color: var(--color-primary-hover);
}


/* -----------------------------------------------------------------------------
Reset Button
Reset ("Clear") Button - styled as a link in the heading row
----------------------------------------------------------------------------- */

.filter-reset-btn {
display: flex;
align-items: center;
gap: var(--space-2);
width: 100%;
margin-top: var(--space-4);
padding: var(--space-2) var(--space-3);
background-color: transparent;
border: 1px solid var(--color-border);
border-radius: var(--border-radius-sm);
color: var(--color-text-secondary);
padding: 0 2px;
background: none;
border: 0;
border-radius: 3px;
color: var(--color-link);
font-family: var(--font-family-secondary);
font-size: var(--font-size-xs);
font-size: 13px;
font-weight: var(--font-weight-medium);
line-height: 22px;
text-decoration: underline;
cursor: pointer;
transition: background-color var(--transition-fast),
border-color var(--transition-fast),
color var(--transition-fast);
}

.filter-reset-btn[hidden] {
display: none;
}

.filter-reset-btn:hover {
background-color: var(--color-bg-muted);
border-color: var(--color-border-strong);
color: var(--color-text-primary);
color: var(--color-link-hover);
}

.filter-reset-btn:focus {
.filter-reset-btn:focus-visible {
outline: var(--focus-ring-width) solid var(--focus-ring-color);
outline-offset: var(--focus-ring-offset);
outline-offset: -2px;
}


Expand Down Expand Up @@ -465,7 +497,7 @@

/*
Mobile-first: the row is a plain block by default so that .project-grid's
parent (.col-md-10) has a DEFINITE width and the grid's auto-fill resolves
parent (.col-md-9 .col-lg-10) has a DEFINITE width and the grid's auto-fill resolves
to multiple columns. Only at >=992px — where the desktop filter sidebar
appears — do we switch to flex to place the sidebar beside the content.
(A flex parent gives the grid an indefinite width, which collapses auto-fill
Expand All @@ -477,9 +509,3 @@
flex-wrap: wrap;
}
}

/* Keep sidebar column aligned to top */
.project-filter-sidebar {
margin-top: 15px;
align-self: flex-start;
}
35 changes: 31 additions & 4 deletions website/static/website/js/project-listing-filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ const ProjectFilter = (function() {
/** Animation duration in milliseconds */
const FADE_DURATION = 500; // Match with CSS transition duration for .project-card

/** Separator between umbrella names in a card's data-project-keywords */
const KEYWORD_DELIMITER = '|';


// ==========================================================================
// INITIALIZATION
Expand Down Expand Up @@ -254,8 +257,7 @@ const ProjectFilter = (function() {
let completedVisibleCount = 0;

elements.projectCards.forEach(function(card) {
const keywords = card.dataset.projectKeywords || '';
const matches = keywords.indexOf(filterKeyword) !== -1;
const matches = cardHasTopic(card, filterKeyword);
const isInActiveGrid = elements.activeGrid && elements.activeGrid.contains(card);

if (matches) {
Expand All @@ -275,6 +277,31 @@ const ProjectFilter = (function() {
}


/**
* Whether a card belongs to the given topic. data-project-keywords holds the
* card's umbrella short names joined with KEYWORD_DELIMITER (see
* display_project_snippet.html), so we split and compare whole names.
* A substring test would let "Design" match "Maker/Design Tools" (#1474).
*
* @private
* @param {HTMLElement} card - A .project-card element
* @param {string} filterKeyword - An umbrella short name (a button's data-filter)
* @returns {boolean} True if the card is tagged with exactly that name
*
* @example
* // <article data-project-keywords="Maker/Design Tools|Accessibility">
* cardHasTopic(card, 'Design'); // false
* cardHasTopic(card, 'Accessibility'); // true
*/
function cardHasTopic(card, filterKeyword) {
const raw = card.dataset.projectKeywords || '';
if (raw === '') {
return false;
}
return raw.split(KEYWORD_DELIMITER).indexOf(filterKeyword) !== -1;
}


/**
* Show all project cards (used when resetting filter).
*
Expand Down Expand Up @@ -378,7 +405,7 @@ const ProjectFilter = (function() {
*/
function showResetButton() {
if (elements.resetButton) {
elements.resetButton.style.display = 'flex';
elements.resetButton.hidden = false;
}
}

Expand All @@ -390,7 +417,7 @@ const ProjectFilter = (function() {
*/
function hideResetButton() {
if (elements.resetButton) {
elements.resetButton.style.display = 'none';
elements.resetButton.hidden = true;
}
}

Expand Down
3 changes: 2 additions & 1 deletion website/templates/snippets/display_project_snippet.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,10 @@
{% load thumbnail %}
{% load ml_tags %}

{# data-project-keywords: umbrella short names joined by "|", matched whole by project-listing-filter.js (#1474). #}
<article class="project-card"
role="listitem"
data-project-keywords="{% for project_umbrella in project.project_umbrellas.all %}{{ project_umbrella.short_name }} {% endfor %}">
data-project-keywords="{% for project_umbrella in project.project_umbrellas.all %}{{ project_umbrella.short_name }}{% if not forloop.last %}|{% endif %}{% endfor %}">

<!-- Project Thumbnail -->
<div class="project-image">
Expand Down
Loading
Loading