1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-03 09:26:03 +00:00
webvirtcloud/static/js/otp_qr.js
catborise 7196871880 fix(ui): pages have a main heading, a skip link and labelled search boxes
An accessibility sweep (axe-core on 22 pages in four themes, and the
keyboard) found:

- No page had an h1: the page heading was an h3, and pages with their
  own heading (sign-in, Computes, errors) kept an empty one. The heading
  is an h1 at the same size; those pages leave the empty one out, and
  Balance has a hidden h1 beside its breadcrumb. Tests check every page,
  an error page and the lock page for one h1 and no empty heading.
- Keyboard users went through the whole menu on every page: a "Skip to
  content" link shows when it has the focus, and brings the content up
  below the sticky navbar. The OTP QR page takes only a signed token from
  its fragment, not the link's #main.
- Tom Select moves a field's label to its own box, leaving the hidden
  select it keeps unnamed (the Tags field of a host, the owner forms'
  user and VM): the label names it too.
- Put in maintenance was yellow text on white (1.6:1), an outline
  secondary button now.
- The pool page's Volumes heading skipped a level.
2026-11-21 15:16:49 +03:00

9 lines
479 B
JavaScript

// The mailed OTP link carries its token after "#", which no request sends,
// so it is in no access log: the page posts it to get the QR code. A signed
// token has a ":"; another fragment (the "Skip to content" link's) is not one.
var otpQrForm = document.getElementById("otp-qr-form");
if (otpQrForm && location.hash.includes(":")) {
otpQrForm.elements.token.value = location.hash.slice(1);
history.replaceState(null, "", location.pathname);
otpQrForm.submit();
}