|
12 | 12 | are visible. Dynamic :checked ~ rules are generated in the inline <style> |
13 | 13 | block below because the number of options is data-driven. |
14 | 14 |
|
| 15 | + Both the latest-version and older-version variants are always rendered inside |
| 16 | + a wrapper with data-active-variant="latest|older". CSS hides the inactive |
| 17 | + one. install-card-version-sync.js (cookie-mode pages only) flips the |
| 18 | + attribute on version-dropdown change so the swap happens without a page |
| 19 | + refresh; with JS disabled, the server-rendered variant stays and the |
| 20 | + dropdown's POST + redirect path handles the swap on the next request. |
| 21 | + |
15 | 22 | Variables: |
16 | 23 | title (optional) — card heading text; defaults to "Install Boost and get started in your terminal." |
17 | 24 | card_id (IMPORTANT) — unique identifier to scope IDs/names when multiple cards appear on the same page; defaults to slugified title, then "install" |
|
26 | 33 | Dependencies: |
27 | 34 | CSS: card.css, tab.css, install-card.css, code-block.css, forms.css (.dropdown) |
28 | 35 | JS: install-card.js (keyboard nav + ARIA updates; optional — core works without it) |
| 36 | + install-card-version-sync.js (in-place version swap; optional — server roundtrip works without it) |
29 | 37 |
|
30 | 38 | Accessibility: |
31 | 39 | - role="tablist" on tab container, role="tab" on labels, role="tabpanel" on panels |
|
37 | 45 | {% endcomment %} |
38 | 46 | {% with resolved_title=title|slugify|default:"install" %} |
39 | 47 | {% with card_id=card_id|default:resolved_title %} |
40 | | -{% if selected_version_is_non_latest %} |
| 48 | +<div class="install-card-wrapper" |
| 49 | + data-install-card-wrapper |
| 50 | + data-active-variant="{% if selected_version_is_non_latest %}older{% else %}latest{% endif %}"> |
41 | 51 | <section class="install-card install-card--older card" |
42 | | - aria-labelledby="{{ card_id }}-heading"> |
| 52 | + aria-labelledby="{{ card_id }}-older-heading"> |
43 | 53 | <div class="card__header"> |
44 | | - <h2 id="{{ card_id }}-heading" class="card__title install-card__title"> |
| 54 | + <h2 id="{{ card_id }}-older-heading" class="card__title install-card__title"> |
45 | 55 | {{ title|default:"Install Boost and get started in your terminal." }} |
46 | 56 | </h2> |
47 | 57 | </div> |
48 | 58 | <div class="install-card__body px-large"> |
49 | 59 | <p class="install-card__older-message"> |
50 | 60 | You are viewing an older version. See the documentation for installation steps. |
51 | 61 | </p> |
52 | | - <div class="install-card__older-cta"> |
| 62 | + <div class="install-card__older-cta" data-install-card-doc-link-wrapper> |
53 | 63 | {% include "v3/includes/_button.html" with label="See Documentation" url=selected_version.documentation_url style="teal" aria_label="See documentation for installation steps" only %} |
54 | 64 | </div> |
55 | 65 | </div> |
56 | 66 | </section> |
57 | | -{% else %} |
58 | 67 | {# Per-option visibility rules (generated from data, complements static rules in install-card.css) #} |
59 | 68 | <style> |
60 | 69 | {% for opt in install_card_pkg_managers %} |
@@ -149,6 +158,6 @@ <h2 id="{{ card_id }}-heading" class="card__title install-card__title"> |
149 | 158 | </div> |
150 | 159 | </div> |
151 | 160 | </section> |
152 | | -{% endif %} |
| 161 | +</div> |
153 | 162 | {% endwith %} |
154 | 163 | {% endwith %} |
0 commit comments