Fix SX nav morphing, retry error modal, and aria-selected CSS extraction

- Re-read verb URL from element attributes at execution time so morphed
  nav links navigate to the correct destination
- Reset retry backoff on fresh requests; skip error modal when sx-retry
  handles the failure
- Strip attribute selectors in CSS registry so aria-selected:* classes
  resolve correctly for on-demand CSS
- Add @css annotations for dynamic aria-selected variant classes
- Add SX docs integration test suite (102 tests)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-03 20:37:17 +00:00
parent f551fc7453
commit 03f0929fdf
5 changed files with 457 additions and 1 deletions

View File

@@ -542,8 +542,10 @@ document.addEventListener('DOMContentLoaded', () => {
document.body.addEventListener("sx:responseError", function (event) {
var resp = event.detail.response;
if (!resp) return;
var status = resp.status || 0;
// Don't show error modal when sx-retry will handle the failure
var triggerEl = event.target;
if (triggerEl && triggerEl.getAttribute("sx-retry")) return;
var status = resp.status || 0;
var form = triggerEl ? triggerEl.closest("form") : null;
var title = "Something went wrong";

View File

@@ -1685,9 +1685,17 @@
// ---- Request executor -------------------------------------------------
function executeRequest(el, verbInfo, extraParams) {
// Re-read verb from element in case attributes were morphed since binding
var currentVerb = getVerb(el);
if (currentVerb) verbInfo = currentVerb;
var method = verbInfo.method;
var url = verbInfo.url;
// Reset retry backoff on fresh (non-retry) requests
if (!el.classList.contains("sx-error")) {
el.removeAttribute("data-sx-retry-ms");
}
// sx-media: skip if media query doesn't match
var media = el.getAttribute("sx-media");
if (media && !window.matchMedia(media).matches) return Promise.resolve();