From 617d82e583a473e3be90d38a6b122790eb5db4e1 Mon Sep 17 00:00:00 2001 From: Jonas Earendel Date: Sun, 26 Oct 2025 19:34:38 -0400 Subject: [PATCH] =?UTF-8?q?Removed=20a=20`console.log`=20from=20updateSort?= =?UTF-8?q?ableAriaLabel.ts=20=F0=9F=A4=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .husky/pre-commit | 1 + CHANGELOG.md | 7 +++++++ dist/esm/enhanceSortableAccessibility.js | 2 +- dist/esm/enhanceSortableAccessibility.min.js | 2 +- dist/esm/sortable.a11y.min.js | 2 +- dist/esm/sortable.auto.d.ts | 2 +- dist/esm/sortable.d.ts | 2 +- dist/sortable.a11y.js | 2 +- dist/sortable.a11y.min.js | 2 +- dist/sortable.auto.js | 2 +- dist/sortable.auto.min.js | 13 ++++++------- dist/standalone/sortable.a11y.js | 2 +- dist/standalone/sortable.a11y.min.js | 2 +- dist/standalone/sortable.auto.js | 2 +- dist/standalone/sortable.auto.min.js | 14 +++++++------- docs/sortable.auto.js | 2 +- eslint.config.js | 1 + package.json | 4 ++-- src/a11y/updateSortableAriaLabel.ts | 4 ++-- src/sortable.auto.ts | 2 +- src/sortable.ts | 2 +- 21 files changed, 40 insertions(+), 32 deletions(-) diff --git a/.husky/pre-commit b/.husky/pre-commit index 645d027..3eb8cde 100644 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1 +1,2 @@ npm run check-branch +npm run lint \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index dfa7a53..f31afb3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [4.1.7] - 2025-10-26 + +### Fixed + +- Removed a `console.log` from **updateSortableAriaLabel.ts** 🤦 + ## [4.1.6] - 2025-10-21 ### Fixed @@ -208,6 +214,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - First release +[4.1.7]: https://github.com/tofsjonas/sortable/releases/tag/4.1.7 [4.1.6]: https://github.com/tofsjonas/sortable/releases/tag/4.1.6 [4.1.5]: https://github.com/tofsjonas/sortable/releases/tag/4.1.5 [4.1.4]: https://github.com/tofsjonas/sortable/releases/tag/4.1.4 diff --git a/dist/esm/enhanceSortableAccessibility.js b/dist/esm/enhanceSortableAccessibility.js index 77d7d15..2c2509e 100644 --- a/dist/esm/enhanceSortableAccessibility.js +++ b/dist/esm/enhanceSortableAccessibility.js @@ -4,7 +4,7 @@ function updateSortableAriaLabel(element, default_direction) { var current_direction = element.getAttribute("aria-sort"), new_direction = default_direction; current_direction && (new_direction = current_direction === "descending" ? "ascending" : "descending"), aria_label = "Click to sort table by ".concat(header_text, " in ").concat(new_direction, " order"); } - element.setAttribute("aria-label", aria_label), element.setAttribute("title", aria_label), console.log("🚀 comment me out"); + element.setAttribute("aria-label", aria_label); } function enhanceSortableAccessibility(tables) { function handleKeyDown(event) { diff --git a/dist/esm/enhanceSortableAccessibility.min.js b/dist/esm/enhanceSortableAccessibility.min.js index e2c3238..d8e644b 100644 --- a/dist/esm/enhanceSortableAccessibility.min.js +++ b/dist/esm/enhanceSortableAccessibility.min.js @@ -1 +1 @@ -function t(t,n){var e=t.textContent||'element',i='Column '.concat(e,' is not sortable');if('no-sort'!==n){var o=t.getAttribute('aria-sort'),c=n;o&&(c='descending'===o?'ascending':'descending'),i='Click to sort table by '.concat(e,' in ').concat(c,' order')}t.setAttribute('aria-label',i),t.setAttribute('title',i),console.log('🚀 comment me out')}function n(n){function e(t){'Enter'===t.key&&t.target.click()}n.forEach(function(n){var i=n.classList.contains('asc')?'ascending':'descending';n.querySelectorAll('th').forEach(function(n){var o=n;if(!o.hasAttribute('tabindex')){if(o.classList.contains('no-sort'))return void t(o,'no-sort');o.setAttribute('tabindex','0');var c=function(){t(o,i)};c(),o.addEventListener('click',function(){setTimeout(c,50)}),o.addEventListener('focus',c),o.addEventListener('keydown',e)}})})}export{n as enhanceSortableAccessibility}; +function t(t,n){var e=t.textContent||'element',i='Column '.concat(e,' is not sortable');if('no-sort'!==n){var o=t.getAttribute('aria-sort'),c=n;o&&(c='descending'===o?'ascending':'descending'),i='Click to sort table by '.concat(e,' in ').concat(c,' order')}t.setAttribute('aria-label',i)}function n(n){function e(t){'Enter'===t.key&&t.target.click()}n.forEach(function(n){var i=n.classList.contains('asc')?'ascending':'descending';n.querySelectorAll('th').forEach(function(n){var o=n;if(!o.hasAttribute('tabindex')){if(o.classList.contains('no-sort'))return void t(o,'no-sort');o.setAttribute('tabindex','0');var c=function(){t(o,i)};c(),o.addEventListener('click',function(){setTimeout(c,50)}),o.addEventListener('focus',c),o.addEventListener('keydown',e)}})})}export{n as enhanceSortableAccessibility}; diff --git a/dist/esm/sortable.a11y.min.js b/dist/esm/sortable.a11y.min.js index 41be421..467ccdd 100644 --- a/dist/esm/sortable.a11y.min.js +++ b/dist/esm/sortable.a11y.min.js @@ -1 +1 @@ -function t(t,e){var n=t.textContent||'element',o='Column '.concat(n,' is not sortable');if('no-sort'!==e){var i=t.getAttribute('aria-sort'),c=e;i&&(c='descending'===i?'ascending':'descending'),o='Click to sort table by '.concat(n,' in ').concat(c,' order')}t.setAttribute('aria-label',o),t.setAttribute('title',o),console.log('🚀 comment me out')}document.addEventListener('DOMContentLoaded',function(){!function(e){function n(t){'Enter'===t.key&&t.target.click()}e.forEach(function(e){var o=e.classList.contains('asc')?'ascending':'descending';e.querySelectorAll('th').forEach(function(e){var i=e;if(!i.hasAttribute('tabindex')){if(i.classList.contains('no-sort'))return void t(i,'no-sort');i.setAttribute('tabindex','0');var c=function(){t(i,o)};c(),i.addEventListener('click',function(){setTimeout(c,50)}),i.addEventListener('focus',c),i.addEventListener('keydown',n)}})})}(document.querySelectorAll('.sortable'))}); +function t(t,n){var e=t.textContent||'element',o='Column '.concat(e,' is not sortable');if('no-sort'!==n){var i=t.getAttribute('aria-sort'),c=n;i&&(c='descending'===i?'ascending':'descending'),o='Click to sort table by '.concat(e,' in ').concat(c,' order')}t.setAttribute('aria-label',o)}document.addEventListener('DOMContentLoaded',function(){!function(n){function e(t){'Enter'===t.key&&t.target.click()}n.forEach(function(n){var o=n.classList.contains('asc')?'ascending':'descending';n.querySelectorAll('th').forEach(function(n){var i=n;if(!i.hasAttribute('tabindex')){if(i.classList.contains('no-sort'))return void t(i,'no-sort');i.setAttribute('tabindex','0');var c=function(){t(i,o)};c(),i.addEventListener('click',function(){setTimeout(c,50)}),i.addEventListener('focus',c),i.addEventListener('keydown',e)}})})}(document.querySelectorAll('.sortable'))}); diff --git a/dist/esm/sortable.auto.d.ts b/dist/esm/sortable.auto.d.ts index b6039b7..4105f4a 100644 --- a/dist/esm/sortable.auto.d.ts +++ b/dist/esm/sortable.auto.d.ts @@ -1,5 +1,5 @@ /** - * sortable v4.1.6 + * sortable * * https://www.npmjs.com/package/sortable-tablesort * https://github.com/tofsjonas/sortable diff --git a/dist/esm/sortable.d.ts b/dist/esm/sortable.d.ts index b6039b7..4105f4a 100644 --- a/dist/esm/sortable.d.ts +++ b/dist/esm/sortable.d.ts @@ -1,5 +1,5 @@ /** - * sortable v4.1.6 + * sortable * * https://www.npmjs.com/package/sortable-tablesort * https://github.com/tofsjonas/sortable diff --git a/dist/sortable.a11y.js b/dist/sortable.a11y.js index fcb43f4..909d389 100644 --- a/dist/sortable.a11y.js +++ b/dist/sortable.a11y.js @@ -4,7 +4,7 @@ function updateSortableAriaLabel(element, default_direction) { var current_direction = element.getAttribute("aria-sort"), new_direction = default_direction; current_direction && (new_direction = current_direction === "descending" ? "ascending" : "descending"), aria_label = "Click to sort table by ".concat(header_text, " in ").concat(new_direction, " order"); } - element.setAttribute("aria-label", aria_label), element.setAttribute("title", aria_label), console.log("🚀 comment me out"); + element.setAttribute("aria-label", aria_label); } function enhanceSortableAccessibility(tables) { function handleKeyDown(event) { diff --git a/dist/sortable.a11y.min.js b/dist/sortable.a11y.min.js index e54181d..3054983 100644 --- a/dist/sortable.a11y.min.js +++ b/dist/sortable.a11y.min.js @@ -1,3 +1,3 @@ -function updateSortableAriaLabel(d,e){var a=d.textContent||"element",c="Column ".concat(a," is not sortable");e!=="no-sort"&&((c=d.getAttribute("aria-sort"))&&(e=c==="descending"?"ascending":"descending"),c="Click to sort table by ".concat(a," in ").concat(e," order"));d.setAttribute("aria-label",c);d.setAttribute("title",c);console.log("\ud83d\ude80 comment me out")} +function updateSortableAriaLabel(d,e){var a=d.textContent||"element",c="Column ".concat(a," is not sortable");e!=="no-sort"&&((c=d.getAttribute("aria-sort"))&&(e=c==="descending"?"ascending":"descending"),c="Click to sort table by ".concat(a," in ").concat(e," order"));d.setAttribute("aria-label",c)} function enhanceSortableAccessibility(d){function e(a){a.key==="Enter"&&a.target.click()}d.forEach(function(a){var c=a.classList.contains("asc")?"ascending":"descending";a.querySelectorAll("th").forEach(function(b){if(!b.hasAttribute("tabindex"))if(b.classList.contains("no-sort"))updateSortableAriaLabel(b,"no-sort");else{b.setAttribute("tabindex","0");var f=function(){updateSortableAriaLabel(b,c)};f();b.addEventListener("click",function(){setTimeout(f,50)});b.addEventListener("focus",f);b.addEventListener("keydown", e)}})})}document.addEventListener("DOMContentLoaded",function(){enhanceSortableAccessibility(document.querySelectorAll(".sortable"))}); diff --git a/dist/sortable.auto.js b/dist/sortable.auto.js index c9920f9..5bf568d 100644 --- a/dist/sortable.auto.js +++ b/dist/sortable.auto.js @@ -1 +1 @@ -(function(){"use strict";function sortSortable(table,alt_sort){var null_last_class="n-last",th=table.tHead.querySelector("th[aria-sort]");if(!th)return;table.dispatchEvent(new Event("sort-start",{bubbles:!0}));var th_row=table.tHead.children[0],direction=th.getAttribute("aria-sort"),reverse=direction==="ascending",sort_null_last=table.classList.contains(null_last_class);function getValue(element){var _a;if(!element)return"";if(alt_sort&&element.dataset.sortAlt!==void 0)return element.dataset.sortAlt;if(element.dataset.sort!==void 0)return element.dataset.sort;var first_child=element.firstChild;if(first_child)switch(first_child.nodeName){case"TIME":return first_child.dateTime;case"DATA":return first_child.value;case"METER":return first_child.value;case"PROGRESS":return first_child.value;case"ABBR":return first_child.title}return((_a=element.textContent)!==null&&_a!==void 0?_a:"").trim()}for(var compareFn=function(a,b,index){var x=getValue(b.cells[index]),y=getValue(a.cells[index]);if(sort_null_last){if(x===""&&y!=="")return-1;if(y===""&&x!=="")return 1}var temp=+x-+y,bool=isNaN(temp)?x.localeCompare(y):temp;return bool===0&&th_row.cells[index]&&th_row.cells[index].hasAttribute("data-sort-tbr")?compareFn(a,b,+th_row.cells[index].dataset.sortTbr):reverse?-bool:bool},i=0;i