[Русская версия](../../portal/ux_guidelines.md)
Supplier Portal UX & Accessibility Guidelines
This document captures the UX rules that govern the supplier portal after consolidating layout macros and addressing the non-functional scope of Task 14 (TZ-870–TZ-934). It is the single source of truth for designers, engineers, and QA when building new views or validating accessibility.
0. Design system foundations
- **Token catalogue.** The style guide now surfaces the Aurora design system metadata (name, version, token groups) and links to the canonical custom property bundle served at `/portal/design-system.css`, which is generated by `render_design_custom_properties()` in the public portal blueprint.【F:src/SupplierManagement/portal/public.py†L552-L705】【F:src/SupplierManagement/design_system.py†L820-L835】
- **Semantic theming.** Light and dark palettes are serialised as `--ds-semantic-*` variables and exported alongside `[data-theme]` overrides, so both portals inherit Aurora surfaces, text, and border colours without duplicating CSS. The base template now embeds the theme-aware bundle returned by `render_design_custom_properties(include_themes=True)`.【F:src/SupplierManagement/design_system.py†L13-L220】【F:src/SupplierManagement/design_system.py†L860-L980】【F:src/SupplierManagement/portal/template_utils.py†L180-L220】【F:src/SupplierManagement/internal/main.py†L640-L700】
- **Color, type, spacing panels.** Dedicated panels render brand swatches, typography families, and the spacing scale directly from the design tokens so contributors can copy the canonical `--ds-*` values without inspecting the source code.【F:src/SupplierManagement/portal/public.py†L581-L666】【F:src/SupplierManagement/portal/templates/style_guide.html†L18-L141】
- **Component highlights.** Buttons, metric cards, and table treatments expose their component tokens, making it clear which `--ds-component-*` properties drive critical procurement flows.【F:src/SupplierManagement/portal/public.py†L668-L705】【F:src/SupplierManagement/portal/templates/style_guide.html†L142-L199】
- **Coverage matrix.** The style guide aggregates every portal route from the `design_registry`, groups them by domain (procurement, operations, support, etc.), and surfaces counters so teams can confirm which screens already consume Aurora layouts and tokens.【F:src/SupplierManagement/portal/public.py†L821-L903】【F:src/SupplierManagement/portal/templates/style_guide.html†L186-L241】
1. Layout fundamentals
- **Shared containers.** Tables and cards must be rendered via the `table_row`/`table_cell` macros and wrapped in `rounded-2xl border border-slate-200 shadow-sm`. The canonical implementations live in `portal/templates/macros.html` and the roadmap, dashboard, and follow-up templates.【F:src/SupplierManagement/portal/templates/macros.html†L1-L180】【F:src/SupplierManagement/portal/templates/roadmap.html†L1-L780】【F:src/SupplierManagement/portal/templates/dashboard.html†L548-L706】【F:src/SupplierManagement/portal/templates/contracts_follow_up.html†L1-L320】
- **Responsive behaviour.** Layout width is capped with `max-w-7xl`; grid utilities (`grid`, `gap-x-6`, `gap-y-4`, `sm:px-6`) drive the tablet/mobile experience. Profile and performance templates demonstrate the required breakpoints.【F:src/SupplierManagement/portal/templates/profile.html†L150-L278】【F:src/SupplierManagement/portal/templates/performance.html†L1-L220】
- **Palette & contrast.** Status highlights use `text-indigo-700 bg-indigo-50`, `text-emerald-700 bg-emerald-50`, and `text-amber-700 bg-amber-50`, delivering ≥ 4.5:1 contrast verified by the Lighthouse audit.【F:docs/accessibility/lighthouse-report.md†L1-L15】
- **Metric cards & quick filters.** Render KPIs with `ui-metric` (including the `ui-metric--accent-*` variants) and surface saved filters with `ui-filter-card` so hover/focus states and spacing match across the supplier and internal portals. See the internal task queue and shared stylesheet for the canonical implementation.【F:src/SupplierManagement/internal/templates/tasks.html†L7-L211】【F:src/SupplierManagement/portal/static/css/input.css†L1563-L1608】
2. Typography & data density
- **Numeric columns.** Always include `tabular-nums text-right` and the shared rounding format enforced by regression tests for the dashboard and order tables.【F:tests/portal/test_dashboard.py†L1-L66】【F:tests/internal/test_orders.py†L1-L121】
- **Headings & helper text.** Primary headings (`≤ 60` characters) use `text-lg font-semibold text-slate-900`; helper copy uses `text-sm text-slate-600`. Tooltips rely on the `hint_badge` macro which auto-injects `sr-only` content for screen readers.【F:src/SupplierManagement/portal/templates/macros.html†L182-L256】
- **Status pills.** Boolean/state indicators must reuse the `status_pill` macro; extending styles outside the macro is prohibited because it already exposes colour modifiers and accessible labels.【F:src/SupplierManagement/portal/templates/macros.html†L258-L332】
3. Accessibility (a11y)
- **Keyboard navigation.** Interactive controls include the `focus-visible` outline through the shared button macros. Custom controls must copy the macro semantics (`tabindex`, `aria-*`). CSRF and OTP login tests ensure keyboard-only navigation remains functional.【F:tests/portal/test_csrf_enforcement.py†L41-L158】【F:tests/SupplierManagement/test_portal_login_otp.py†L1-L58】
- **Screen-reader feedback.** Alerts broadcast through `role="status"`/`aria-live="polite"`. Use the `alert_banner` macro (see the supplier dashboard action centre) when introducing new banners.【F:src/SupplierManagement/portal/templates/dashboard.html†L430-L520】【F:src/SupplierManagement/portal/templates/macros.html†L334-L420】
- **Contrast & scaling.** Minimum touch target size is 44×44 px. High-contrast mode is toggled with the `contrast-boost` CSS helper described in the accessibility preference guide and covered by personalisation tests.【F:docs/accessibility/portal_preferences.md†L1-L80】【F:tests/portal/test_preferences.py†L1-L144】
4. Behaviour & feedback
- **Loading skeletons.** Asynchronous widgets must render the `loading_state` macro (shimmer) across roadmap, performance, and analytics screens; omitting it is treated as a UX defect.
- **Empty states.** Use `empty_state` for icon/message/CTA blocks. Deviations require UX approval. The roadmap regression test ensures empty datasets render the shared block.【F:tests/portal/test_roadmap.py†L1-L76】
- **Errors & notifications.** Forms display field-level errors using `text-sm text-red-600` and surface toast/alert banners. API errors are normalised in `portal/dependencies.py`; exposing raw JSON to users is forbidden.【F:src/SupplierManagement/portal/dependencies.py†L1-L188】
5. Quality gates
- **Lighthouse threshold.** Run the desktop and mobile presets for every release; both accessibility scores must stay ≥ 90. Results are tracked in `docs/accessibility/lighthouse-report.md` and CI artefacts.
- **UI regression coverage.** Any macro change requires updated tests covering dashboard, orders, roadmap, and supplier detail templates to prevent regressions.【F:tests/internal/test_supplier_detail.py†L1-L74】
- **Resilience smoke tests.** The integration suite `tests/integration/test_resilience.py` validates that OpenTelemetry providers are initialised. Treat a missing provider as a release blocker to satisfy Task 14 readiness gates.【F:tests/integration/test_resilience.py†L1-L80】
6. Public landing page
- **Data model.** The landing page context is supplied by `PortalHomeContent`, a frozen dataclass that aggregates hero metadata, feature clusters, journey steps, resource cards, a closing call-out, and the accessibility preferences widget. Each textual field is wrapped in `LocalisedCopy` so templates may expose both translated text and the English source for regression tests.【F:src/SupplierManagement/portal/public.py†L104-L266】【F:src/SupplierManagement/portal/public.py†L333-L448】【F:src/SupplierManagement/portal/public.py†L466-L520】
- **Hero & metrics.** The hero block renders CTA buttons, highlight bullets, and three `ui-metric` components using the gradient tokens from the Aurora bundle. Buttons must honour the tone defined in the dataclass to reuse the shared `ui-button` modifiers.【F:src/SupplierManagement/portal/templates/index.html†L1-L63】【F:src/SupplierManagement/portal/static/css/custom.css†L49-L153】
- **Feature sections.** Lifecycle and collaboration pillars are displayed as `ui-card` clusters with bullet lists that inherit typography tokens (`var(--font-size-lg)`, `var(--color-text-secondary)`) to maintain parity with dashboard layouts.【F:src/SupplierManagement/portal/templates/index.html†L88-L139】【F:src/SupplierManagement/portal/static/css/custom.css†L207-L292】
- **Journey timeline.** Four onboarding steps use muted cards with numbered badges and reinforce the process outlined in accreditation workflows. The responsive grid mirrors the spacing system shared by the roadmap template.【F:src/SupplierManagement/portal/templates/index.html†L65-L86】【F:src/SupplierManagement/portal/static/css/custom.css†L165-L206】
- **Support ecosystem.** Resource cards link to support, legal, and design system routes; badges use semantic colours from the token set so hover/focus states match the rest of the portal.【F:src/SupplierManagement/portal/templates/index.html†L141-L179】【F:src/SupplierManagement/portal/static/css/custom.css†L310-L356】
- **Accessibility controls.** The landing surface embeds an interactive panel powered by `accessibilityPreferences()` with `data-accessibility-pref` inputs for high contrast, larger text, and reduced motion. The helper text clarifies persistence semantics and the `Reset to defaults` CTA is mandatory for UX parity with the dashboard preferences tray.【F:src/SupplierManagement/portal/templates/index.html†L181-L241】【F:src/SupplierManagement/portal/static/css/custom.css†L358-L431】【F:tests/portal/test_accessibility.py†L68-L99】
- **Workspace site map.** A grouped site map derived from `build_navigation_site_map` highlights procurement, operations, performance, and utility workspaces so visitors can preview every section directly from the landing page.【F:src/SupplierManagement/portal/navigation.py†L151-L205】【F:src/SupplierManagement/portal/public.py†L593-L638】【F:src/SupplierManagement/portal/templates/index.html†L200-L257】
Adhering to these guidelines keeps the supplier portal accessible, consistent, and ready for scale as the SRM roadmap evolves.