Repository: ymrl/a11y-visualizer
Pull request #26 (2024-04-27 14:49:21)

:bug: hide noname message if aria-hidden


Patch:
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 49bd276..17f373f 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -25,14 +25,14 @@ jobs:
       - name: Install dependencies
         run: npm ci
 
+      - name: Release
+        run: npm run release -- ${{ github.event.inputs.release_type }}
+
       - name: Git config
         run: |
           git config --global user.name 'github-actions[bot]'
           git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
 
-      - name: Release
-        run: npm run release -- ${{ github.event.inputs.release_type }}
-
       - name: Push changes
         uses: ad-m/github-push-action@v0.6.0
         with:
@@ -42,7 +42,7 @@ jobs:
 
       - name: Get version
         id: get_version
-        run: echo "::set-output name=VERSION::$(jq -r .version package.json)"
+        run: echo "::set-output name=VERSION::$(node -e \"console.log(require('./package.json').version)\")"
 
       - name: Create Release
         id: create_release
diff --git a/manifest.json b/manifest.json
index 70024e6..5bd4e31 100644
--- a/manifest.json
+++ b/manifest.json
@@ -1,7 +1,7 @@
 {
   "manifest_version": 3,
   "name": "Accessibility Visualizer",
-  "version": "0.4.0",
+  "version": "0.3.0",
   "action": {
     "default_popup": "src/popup/index.html"
   },
diff --git a/package-lock.json b/package-lock.json
index 2ebfbe2..d000fc1 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
 {
   "name": "a11y-visualizer",
-  "version": "0.4.0",
+  "version": "0.3.0",
   "lockfileVersion": 3,
   "requires": true,
   "packages": {
     "": {
       "name": "a11y-visualizer",
-      "version": "0.4.0",
+      "version": "0.3.0",
       "dependencies": {
         "dom-accessibility-api": "^0.6.3",
         "i18next": "^23.10.1",
diff --git a/package.json b/package.json
index f263465..49f1bd3 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
 {
   "name": "a11y-visualizer",
   "private": true,
-  "version": "0.4.0",
+  "version": "0.3.0",
   "type": "module",
   "scripts": {
     "dev": "vite",
diff --git a/src/content/dom/tips/imageTips.ts b/src/content/dom/tips/imageTips.ts
index e576901..aada76d 100644
--- a/src/content/dom/tips/imageTips.ts
+++ b/src/content/dom/tips/imageTips.ts
@@ -10,7 +10,7 @@ export const imageTips = (el: Element): ElementTip[] => {
     const name = computeAccessibleName(el);
     if (name) {
       result.push({ type: "name", content: name });
-    } else if (!isAriaHidden(el) || roleAttr !== "presentation") {
+    } else if (!isAriaHidden(el) && roleAttr !== "presentation") {
       if (tagName === "img") {
         const hasAlt = el.hasAttribute("alt");
         if (hasAlt) {


Test patch:
diff --git a/src/content/dom/tips/imageTips.test.ts b/src/content/dom/tips/imageTips.test.ts
index 28e3cd0..00198cf 100644
--- a/src/content/dom/tips/imageTips.test.ts
+++ b/src/content/dom/tips/imageTips.test.ts
@@ -51,4 +51,16 @@ describe("imageTips()", () => {
       content: "messages.noName",
     });
   });
+
+  test("aria-hidden svg", () => {
+    const element = document.createElement("svg");
+    element.setAttribute("aria-hidden", "true");
+    document.body.appendChild(element);
+    const result = imageTips(element);
+    expect(result).toHaveLength(1);
+    expect(
+      result.find((e) => e.type === "tagName" && e.content === "svg"),
+    ).toBeDefined();
+    expect(result.find((e) => e.type === "error")).toBeUndefined();
+  });
 });