From cd2def37491783a491bc04631cbd40346838e0ca Mon Sep 17 00:00:00 2001 From: Julia Hoang Date: Tue, 17 Mar 2026 14:53:38 -0700 Subject: [PATCH 1/2] Fix ID usage in Install Card componenet --- static/css/v3/install-card.css | 43 ++++-- static/js/install-card.js | 143 ++++++++---------- .../v3/examples/_v3_example_section.html | 7 +- templates/v3/includes/_install_card.html | 121 +++++++++++---- .../_install_card_tab_content_body.html | 27 +++- 5 files changed, 206 insertions(+), 135 deletions(-) diff --git a/static/css/v3/install-card.css b/static/css/v3/install-card.css index 46a26ccb5..1476019fe 100644 --- a/static/css/v3/install-card.css +++ b/static/css/v3/install-card.css @@ -3,7 +3,14 @@ Tabs + dropdown selector + command display for getting-started install instructions. Uses CSS radio inputs for tab switching and option selection (no JS required). Builds on .card (card.css), .dropdown (forms.css), .code-block (code-block.css). - The tabs are styled in tab.css + Tabs styled by tab.css. + + Architecture — two levels of radio-driven show/hide: + 1. Tab radios (.install-card__radio--pkg / --sys) are direct children of
. + Static :checked ~ sibling rules below toggle .install-card__panel visibility. + 2. Option radios per tab (e.g. Vcbkg, Conan) are siblings of .code-block inside each panel. + Dynamic :checked ~ rules are generated by Django in _install_card.html's + inline
+ aria-labelledby="{{ card_id }}-heading"> {# Tab radio inputs — must be direct children of section for sibling selectors #} + class="install-card__radio install-card__radio--pkg"> + name="{{ card_id }}-tab" + id="{{ card_id }}-tab-sys" + class="install-card__radio install-card__radio--sys">
-

+

{{ title|default:"Install Boost and get started in your terminal." }}

{# Tab list #}
- - + + id="{{ card_id }}-tab-sys-label" + aria-controls="{{ card_id }}-panel-sys" + aria-selected="false" + tabindex="-1">System Install
{# Panel: Package Managers #} -
- {% include "v3/includes/_install_card_tab_content_body.html" with options=install_card_pkg_managers prefix="pkg" only %} + aria-labelledby="{{ card_id }}-tab-pkg-label"> + {% include "v3/includes/_install_card_tab_content_body.html" with options=install_card_pkg_managers prefix="pkg" card_id=card_id only %}
{# Panel: System Install #} -
- {% include "v3/includes/_install_card_tab_content_body.html" with options=install_card_system_install prefix="sys" only %} + aria-labelledby="{{ card_id }}-tab-sys-label"> + {% include "v3/includes/_install_card_tab_content_body.html" with options=install_card_system_install prefix="sys" card_id=card_id only %}
+{% endwith %} +{% endwith %} diff --git a/templates/v3/includes/_install_card_tab_content_body.html b/templates/v3/includes/_install_card_tab_content_body.html index a655869cd..be5c196b6 100644 --- a/templates/v3/includes/_install_card_tab_content_body.html +++ b/templates/v3/includes/_install_card_tab_content_body.html @@ -1,21 +1,34 @@ {% comment %} V3 Install Card — Tab Content Body + Internal sub-component — included only by _install_card.html. Do not use directly. + Pre-rendered code block with embedded dropdown for one tab. Uses CSS radio inputs for option selection (no JS required). CSS: install-card.css, code-block.css, forms.css (.dropdown) + Structure: + Radio inputs and .code-block must be siblings (not nested) because the dynamic +