Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
180 changes: 172 additions & 8 deletions scripts/preview-browser.mjs

Large diffs are not rendered by default.

9 changes: 6 additions & 3 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,15 +136,18 @@ export function App() {
{report && <PrintableReport report={report}/>}
<a className="skip-link" href="#main">Skip to content</a>
<header className="site-header">
<a className="brand" href="#"><span className="brand-icon" aria-hidden="true">k<span>↗</span></span>KindPath</a>
<a className="brand" href="#">KindPath</a>
</header>
<main id="main" tabIndex={-1}>
<section className="hero" aria-labelledby="landing-title">
<div className="hero-copy">
<h1 id="landing-title">A clearer web.<br/><em>For everyone.</em></h1>
<div className="hero-heading">
<h1 id="landing-title">A clearer web.<br/><em>For everyone.</em></h1>
<span className={report ? "landing-sprite landing-frog landing-frog-celebrate" : "landing-sprite landing-frog"} aria-hidden="true"/>
</div>
<p>Scan a public webpage for accessibility issues and see how it looks with different vision settings.</p>
<WebsiteForm
activity={busy ? 'Checking the page and preparing your report…' : cancelled ? 'Request cancelled. You can try again shortly.' : report ? 'Report ready.' : ''}
activity={busy ? 'Checking the page and preparing your report' : cancelled ? 'Request cancelled. You can try again shortly.' : report ? 'Report ready.' : ''}
reportReady={report !== null} onViewReport={viewReport}
onCancel={cancel} cancelled={cancelled} canRetry={!busy && !!lastAttempt && (failure?.retryable === true || cancelled)}
onRetry={() => { if (lastAttempt) void analyze(lastAttempt); }}
Expand Down
Binary file added src/assets/frog-sprite.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/sprout-sprite.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 6 additions & 4 deletions src/components/FindingsReport.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@ export function FindingsReport({ report }: { report: Report }) {
</ul>
<div className="finding-filter">
<label htmlFor="finding-severity">Filter violations by severity</label>
<select ref={filter} id="finding-severity" value={severity} onChange={event => setSeverity(event.target.value as Finding['severity'] | 'All')}>
<option value="All">All severities</option>
{severityOrder.map(level => <option key={level} value={level}>{level}</option>)}
</select>
<div className="select-field">
<select ref={filter} id="finding-severity" value={severity} onChange={event => setSeverity(event.target.value as Finding['severity'] | 'All')}>
<option value="All">All severities</option>
{severityOrder.map(level => <option key={level} value={level}>{level}</option>)}
</select>
</div>
{severity !== 'All' && <button type="button" className="secondary" onClick={() => { setSeverity('All'); filter.current?.focus(); }}>Clear severity filter</button>}
</div>
<p className="finding-status" role="status">Showing {visible.length} of {report.findings.length} {report.mode === 'demo' ? 'example rules' : 'rules with violations'}.</p>
Expand Down
4 changes: 2 additions & 2 deletions src/components/LandingComparison.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { colourMatrix } from './visualEffects';
const deuteranopiaMatrix = colourMatrix('deuteranopia', 100).join(' ');

function SampleArtwork({ filterId }: { filterId?: string }) {
return <svg viewBox="0 0 440 320" aria-hidden="true">
return <svg width="440" height="320" viewBox="0 0 440 320" preserveAspectRatio="xMidYMid meet" aria-hidden="true">
{filterId && <defs>
<filter id={filterId} x="-5%" y="-5%" width="110%" height="110%" colorInterpolationFilters="linearRGB">
<feColorMatrix type="matrix" values={deuteranopiaMatrix}/>
Expand Down Expand Up @@ -47,6 +47,6 @@ export function LandingComparison() {
<div className="landing-comparison-page"><SampleArtwork filterId={filterId}/></div>
</div>
</div>
<figcaption>Same page, with blur and a red–green colour vision simulation on the right.</figcaption>
<figcaption>Same page, with a deuteranopia + blurred vision simulation on the right.</figcaption>
</figure>;
}
8 changes: 5 additions & 3 deletions src/components/SiteVisualPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@ export function SiteVisualPreview({ snapshot }: { snapshot: SitePreview }) {
</div>
{image && <div className="preview-size">
<label htmlFor="preview-size">Preview size</label>
<select id="preview-size" value={actualSize ? 'actual' : 'fit'} onChange={event => setActualSize(event.target.value === 'actual')}>
<option value="fit">Fit width</option><option value="actual">Actual size</option>
</select>
<div className="select-field">
<select id="preview-size" value={actualSize ? 'actual' : 'fit'} onChange={event => setActualSize(event.target.value === 'actual')}>
<option value="fit">Fit width</option><option value="actual">Actual size</option>
</select>
</div>
</div>}
</div>
{image && snapshot.truncated && <p className="preview-caption">Long page: first 6,000 pixels shown.</p>}
Expand Down
18 changes: 13 additions & 5 deletions src/components/VisionControls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,13 @@ export function VisionPresetControls({ settings, onChange }: VisionControlsProps
<div className="vision-preset-buttons">
{(Object.keys(visionPresets) as VisionPreset[]).map(key =>
<button type="button" className="secondary" key={key} aria-pressed={activePreset === key}
onClick={() => onChange(applyVisionPreset(key))}>{visionPresets[key].name}</button>)}
onClick={() => onChange(applyVisionPreset(key))}>
<svg className="preset-eye" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
<path d="M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12Z"/>
<circle cx="12" cy="12" r="3"/>
<path className="preset-eye-slash" d="m3 3 18 18" pathLength="1" strokeLinecap="butt"/>
</svg>{visionPresets[key].name}
</button>)}
</div>
<p id="vision-presets-note" className="vision-note">Educational approximations. Individual experiences vary.</p>
</div>
Expand All @@ -37,10 +43,12 @@ export function VisionFineTuning({ settings, onChange }: VisionControlsProps) {
<p className="vision-note">Intensity presets set all four strengths.</p>
<div className="colour-choice">
<label htmlFor="colour-preset">Colour preset</label>
<select id="colour-preset" value={settings.colourPreset} aria-describedby="colour-preset-note"
onChange={event => onChange({ ...settings, colourPreset: event.target.value as ColourPreset })}>
{Object.entries(colourPresets).map(([key, name]) => <option key={key} value={key}>{name}</option>)}
</select>
<div className="select-field">
<select id="colour-preset" value={settings.colourPreset} aria-describedby="colour-preset-note"
onChange={event => onChange({ ...settings, colourPreset: event.target.value as ColourPreset })}>
{Object.entries(colourPresets).map(([key, name]) => <option key={key} value={key}>{name}</option>)}
</select>
</div>
<p id="colour-preset-note">The named colour filters use the Machado model. Use Colour strength for milder simulations, with 100% showing the named form. Individual colour vision varies.</p>
</div>
<div className="effect-grid">
Expand Down
7 changes: 5 additions & 2 deletions src/components/WebsiteForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,15 @@ export function WebsiteForm({ url, activity, reportReady, onViewReport, onCancel
{!publicScanningEnabled && <p id="scanner-note">
{capabilitiesLoading ? 'Checking scanner availability…' : 'Website scanning is currently unavailable.'}
</p>}
<p role="status">{activity}</p>
<div className="scan-activity">
{busy && <span className="landing-sprite scan-sprout" aria-hidden="true"/>}
<p role="status">{activity}{busy && <span className="scan-dots" aria-hidden="true">...</span>}</p>
</div>
{scanError && <p ref={errorMessage} tabIndex={-1} role="alert" id="scan-error">{scanError}</p>}
</div>
{busy && <button type="button" className="secondary" onClick={onCancel}>Cancel request</button>}
{canRetry && <button ref={retryButton} type="button" className="secondary" aria-describedby={scanError ? 'scan-error' : undefined} onClick={onRetry}>Try again</button>}
{reportReady && <button ref={reportButton} type="button" className="secondary" onClick={onViewReport}>View report <span aria-hidden="true">↓</span></button>}
{reportReady && <button ref={reportButton} type="button" className="secondary view-report-action" onClick={onViewReport}>View report <span aria-hidden="true">↓</span></button>}
</div>
</form>;
}
Loading
Loading