From 6fc8cb9e32fd1eadc07afa7886433462f3a52a9c Mon Sep 17 00:00:00 2001 From: Miguel Vieira Date: Fri, 19 Jul 2024 14:36:01 +0100 Subject: [PATCH] feat(frontend): display accessibility issues on top Add function to copy the a11y issue target into the clipboard --- frontend/src/routes/_qa/+page.svelte | 93 ++++++++++++++++++---------- 1 file changed, 59 insertions(+), 34 deletions(-) diff --git a/frontend/src/routes/_qa/+page.svelte b/frontend/src/routes/_qa/+page.svelte index aa3ceda53aa..a3640d56e94 100644 --- a/frontend/src/routes/_qa/+page.svelte +++ b/frontend/src/routes/_qa/+page.svelte @@ -3,48 +3,27 @@ /** @type {import('./$types').PageData} */ export let data; + + /** + * @param {string} text + */ + function copyTargetToClipboard(text) { + navigator.clipboard.writeText(`inspect($$("${text}")[0])`); + alert('Copied to clipboard!'); + }

QA

- {#if data.prerender} -
-
-

Build errors

-

{data.prerender.length} build errors found!

-
- - - - - - - - - - - {#each data.prerender as error} - - - - - - - {/each} - -
TimestampPathReferrerMessage
{error.timestamp}{error.path}{error.referrer}{error.message}
-
- {/if} - {#if Object.keys(data.axe).length > 0}

Accessibility issues

{#each Object.keys(data.axe) as page} -
-

{page}

-

{data.axe[page].length} accessibility issues found!

-
+

+ {page} + {data.axe[page].length.toLocaleString()} accessibility issues found! +

@@ -61,7 +40,14 @@ - + {/each} @@ -70,4 +56,43 @@ {/each} {/if} + + {#if data.prerender} +
+
+

Build errors

+

{data.prerender.length} build errors found!

+
+
{violation.id} {violation.impact} {violation.description}{violation.nodes[0].target} + {violation.nodes[0].target} + {violation.help}
+ + + + + + + + + + {#each data.prerender as error} + + + + + + + {/each} + +
TimestampPathReferrerMessage
{error.timestamp}{error.path}{error.referrer}{error.message}
+
+ {/if}
+ +