From dd2d0fdaca6e88a7960e211ea1f66a752e0bdc9b Mon Sep 17 00:00:00 2001 From: Shane <6071159+smashedr@users.noreply.github.com> Date: Mon, 1 Jul 2024 23:45:34 -0700 Subject: [PATCH] Fix ariaLabel for Firefox ESR --- .github/workflows/build.yaml | 3 ++- src/js/extract.js | 5 +++-- src/js/popup.js | 10 +++++----- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 4597d47..351ec0a 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -21,8 +21,8 @@ jobs: node-version: 20 - name: "Update Manifest Version" - uses: cssnr/update-json-value-action@v1 if: ${{ github.event_name == 'release' }} + uses: cssnr/update-json-value-action@v1 - name: "Build All" run: | @@ -36,6 +36,7 @@ jobs: path: web-ext-artifacts/ - name: "Upload to Release" + if: ${{ github.event_name == 'release' }} uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/src/js/extract.js b/src/js/extract.js index dae1165..bf5bd16 100644 --- a/src/js/extract.js +++ b/src/js/extract.js @@ -77,12 +77,13 @@ function extractSelection() { * @param {HTMLAnchorElement} element */ function pushElement(array, element) { + // console.debug('element:', element) try { const data = { href: decodeURI(element.href), - text: element.textContent, + text: element.textContent?.trim(), title: element.title, - label: element.ariaLabel, + label: element.ariaLabel || '', rel: element.rel, target: element.target, origin: element.origin, diff --git a/src/js/popup.js b/src/js/popup.js index 51021c8..93eef9d 100644 --- a/src/js/popup.js +++ b/src/js/popup.js @@ -218,11 +218,11 @@ function extractURLs(text) { const match = urlmatcharr[0] const url = new URL(match) const data = { - text: null, - title: null, - label: null, - target: null, - rel: null, + text: '', + title: '', + label: '', + target: '', + rel: '', href: url.href, origin: url.origin, }