From f8727352ecebaaa6adc24d8afc4222c57ddf4387 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9F=A9=E9=9F=AC?= Date: Fri, 7 Jun 2019 14:57:16 +0100 Subject: [PATCH 1/3] fix #issue3961 --- notebook/static/tree/js/notebooklist.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/notebook/static/tree/js/notebooklist.js b/notebook/static/tree/js/notebooklist.js index 7753a56dd..73ebbfeaf 100644 --- a/notebook/static/tree/js/notebooklist.js +++ b/notebook/static/tree/js/notebooklist.js @@ -234,6 +234,8 @@ define([ that.select('select-all'); } }); + + $('#button-select-all').click(function (e) { // toggle checkbox if the click doesn't come from the checkbox already if (!$(e.target).is('input[type=checkbox]')) { @@ -810,6 +812,19 @@ define([ checked = bidi.applyBidi(checked); $('#counter-select-all').html(checked===0 ? ' ' : checked); + //#issue 3961, update the checkbox aria-label when it changed + if(selected.length>=1){ + if($('#select-all').prop("checked")){ + $('#button-select-all').attr("aria-label","Selected All "+ selected.length+" items"); + } + else{ + $('#button-select-all').attr("aria-label","Selected, "+ selected.length+" items"); + } + } + else{ + $('#button-select-all').attr("aria-label","Select All/None"); + } + // If at aleast on item is selected, hide the selection instructions. if (checked > 0) { $('.dynamic-instructions').hide(); From b1a97cd01bfd19edb94cc2710f1a5eb2cf35b1be Mon Sep 17 00:00:00 2001 From: Joshua Zeltser Date: Tue, 25 Jun 2019 12:07:03 +0100 Subject: [PATCH 2/3] added translation function calls to the added aria-labels --- notebook/static/tree/js/notebooklist.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/notebook/static/tree/js/notebooklist.js b/notebook/static/tree/js/notebooklist.js index 73ebbfeaf..f13e6fb9a 100644 --- a/notebook/static/tree/js/notebooklist.js +++ b/notebook/static/tree/js/notebooklist.js @@ -235,7 +235,6 @@ define([ } }); - $('#button-select-all').click(function (e) { // toggle checkbox if the click doesn't come from the checkbox already if (!$(e.target).is('input[type=checkbox]')) { @@ -815,14 +814,14 @@ define([ //#issue 3961, update the checkbox aria-label when it changed if(selected.length>=1){ if($('#select-all').prop("checked")){ - $('#button-select-all').attr("aria-label","Selected All "+ selected.length+" items"); + $('#button-select-all').attr("aria-label", i18n.msg._("Selected All "+ selected.length+" items")); } else{ - $('#button-select-all').attr("aria-label","Selected, "+ selected.length+" items"); + $('#button-select-all').attr("aria-label", i18n.msg._("Selected, "+ selected.length+" items")); } } else{ - $('#button-select-all').attr("aria-label","Select All/None"); + $('#button-select-all').attr("aria-label", i18n.msg._("Select All/None")); } // If at aleast on item is selected, hide the selection instructions. From 2c239b591baef2dc1a52cd73c3fb5f1830f742bf Mon Sep 17 00:00:00 2001 From: Joshua Zeltser Date: Tue, 25 Jun 2019 16:50:31 +0100 Subject: [PATCH 3/3] changed way translation functions called for non string literals --- notebook/static/tree/js/notebooklist.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/notebook/static/tree/js/notebooklist.js b/notebook/static/tree/js/notebooklist.js index f13e6fb9a..6b0b2a645 100644 --- a/notebook/static/tree/js/notebooklist.js +++ b/notebook/static/tree/js/notebooklist.js @@ -814,10 +814,14 @@ define([ //#issue 3961, update the checkbox aria-label when it changed if(selected.length>=1){ if($('#select-all').prop("checked")){ - $('#button-select-all').attr("aria-label", i18n.msg._("Selected All "+ selected.length+" items")); + // $('#button-select-all').attr("aria-label", i18n.msg._("Selected All "+ selected.length +" items")); + var msg1 = i18n.msg._("Selected All %d items") + $('#button-select-all').attr("aria-label", i18n.msg.sprintf(msg1, selected.length)); } else{ - $('#button-select-all').attr("aria-label", i18n.msg._("Selected, "+ selected.length+" items")); + // $('#button-select-all').attr("aria-label", i18n.msg._("Selected, "+ selected.length+" items")); + var msg2 = i18n.msg._("Selected, %d items") + $('#button-select-all').attr("aria-label", i18n.msg.sprintf(msg2, selected.length)); } } else{