From 3eb963fadf906632325b12d40955c7a24d1388ee Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 28 Apr 2026 07:06:05 +0000 Subject: [PATCH 1/2] Initial plan From 6828074dd1c9f6611faffa71601978ada9da1e5b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 28 Apr 2026 07:11:24 +0000 Subject: [PATCH 2/2] fix: complete WAI-ARIA tabs pattern in checkout.html (aria-selected, aria-controls, tabpanel, keyboard nav) Agent-Logs-Url: https://github.com/dsaub/proyecto-final/sessions/73a76f50-8c55-4285-81cf-931b63290b81 Co-authored-by: dsaub <54474838+dsaub@users.noreply.github.com> --- tienda/templates/tienda/checkout.html | 54 ++++++++++++++++++++++----- 1 file changed, 44 insertions(+), 10 deletions(-) diff --git a/tienda/templates/tienda/checkout.html b/tienda/templates/tienda/checkout.html index 1b88ee9..d12f674 100644 --- a/tienda/templates/tienda/checkout.html +++ b/tienda/templates/tienda/checkout.html @@ -127,19 +127,22 @@ -
+
{% if saved_cards %}

Tarjetas guardadas:

@@ -183,7 +186,8 @@
-
+
{% if saved_paypal %}
Cuenta PayPal guardada: @@ -221,12 +225,42 @@ const HAS_STOCK_ISSUES = {{ stock_issues|yesno:"true,false" }}; const HAS_ADDRESS = {{ addresses|yesno:"true,false" }}; // ---- Tab switching ---- -document.querySelectorAll('#paymentTabs .nav-link').forEach(btn => { - btn.addEventListener('click', () => { - document.querySelectorAll('#paymentTabs .nav-link').forEach(b => b.classList.remove('active')); - document.querySelectorAll('.payment-tab-content').forEach(p => p.classList.remove('active')); - btn.classList.add('active'); - document.getElementById(btn.dataset.tab).classList.add('active'); +const paymentTabs = Array.from(document.querySelectorAll('#paymentTabs .nav-link[role="tab"]')); + +function activateTab(tab) { + paymentTabs.forEach(b => { + const isSelected = b === tab; + b.classList.toggle('active', isSelected); + b.setAttribute('aria-selected', isSelected ? 'true' : 'false'); + b.setAttribute('tabindex', isSelected ? '0' : '-1'); + }); + document.querySelectorAll('.payment-tab-content').forEach(p => p.classList.remove('active')); + document.getElementById(tab.dataset.tab).classList.add('active'); +} + +paymentTabs.forEach(btn => { + btn.addEventListener('click', () => activateTab(btn)); + btn.addEventListener('keydown', e => { + const idx = paymentTabs.indexOf(e.currentTarget); + if (e.key === 'ArrowRight') { + e.preventDefault(); + const next = paymentTabs[(idx + 1) % paymentTabs.length]; + activateTab(next); + next.focus(); + } else if (e.key === 'ArrowLeft') { + e.preventDefault(); + const prev = paymentTabs[(idx - 1 + paymentTabs.length) % paymentTabs.length]; + activateTab(prev); + prev.focus(); + } else if (e.key === 'Home') { + e.preventDefault(); + activateTab(paymentTabs[0]); + paymentTabs[0].focus(); + } else if (e.key === 'End') { + e.preventDefault(); + activateTab(paymentTabs[paymentTabs.length - 1]); + paymentTabs[paymentTabs.length - 1].focus(); + } }); });