Polish the SPA: focus rings, reduced motion, forms that report errors
- Global :focus-visible ring (text fields get a border instead) and a prefers-reduced-motion override; the navbar marquee stops for it too. - Button: disabled state and horizontal padding. - useCreateForm returns error and submitting, so the create forms show a refused save inline and can't double-submit; they, Login, CreatePlace and CreateUser are real <form>s so Enter submits from any field. - Admin: section list wraps on phones, Manage Users is a table with errors, Manage Radio confirms before deleting, page delete errors show inline. - Hard-coded Tailwind colours replaced with tokens; 404 image alt text and no forced scrollbars. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -1,12 +1,14 @@
|
||||
<!--
|
||||
The site's standard button. Wraps a native <button>, so all attributes and
|
||||
listeners (including @click) fall through to it via Vue's attribute inheritance.
|
||||
A disabled button is dimmed and stops reacting to hover and press, so a form
|
||||
that is busy saving looks it.
|
||||
-->
|
||||
<script setup></script>
|
||||
|
||||
<template>
|
||||
<button
|
||||
class="text-primary bg-link-bg text-center border cursor-pointer transition-colors duration-150 ease-in-out hover:bg-surface active:scale-95"
|
||||
class="px-2 text-primary bg-link-bg text-center border cursor-pointer transition-colors duration-150 ease-in-out hover:bg-surface active:scale-95 disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-link-bg disabled:active:scale-100"
|
||||
>
|
||||
<slot />
|
||||
</button>
|
||||
|
||||
@@ -51,6 +51,11 @@ function animate() {
|
||||
let resizeObserver;
|
||||
|
||||
onMounted(() => {
|
||||
// A visitor who asked the OS for less motion gets the text standing still.
|
||||
// The CSS reduced-motion override in styles.css can't reach this: the
|
||||
// movement is a transform written every frame, not a transition.
|
||||
if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) return;
|
||||
|
||||
measureWidth();
|
||||
rafId = requestAnimationFrame(animate);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user