]> _ Git - fluidbook-html5.git/commitdiff
fix #3756 @2
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 3 Jul 2020 18:18:50 +0000 (20:18 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 3 Jul 2020 18:18:50 +0000 (20:18 +0200)
js/libs/fluidbook/fluidbook.audiodescription.js
js/libs/fluidbook/fluidbook.bookmarks.js
js/libs/fluidbook/fluidbook.l10n.js
js/libs/fluidbook/fluidbook.links.js
js/libs/fluidbook/fluidbook.loader.js
js/libs/fluidbook/fluidbook.menu.js
js/libs/fluidbook/fluidbook.nav.js
js/libs/fluidbook/fluidbook.search.js
js/libs/fluidbook/fluidbook.tooltip.js
js/libs/fluidbook/links/fluidbook.links.zoom.js

index aeba657963ad2864cc8e38009cbb9773cc91a955..0f0e9bfa7b818c6aba6ffc0b23f7c6d6d6a40ef1 100644 (file)
@@ -24,9 +24,13 @@ function FluidbookAudioDescription(fluidbook) {
     this.buttonLeft = document.createElement('a');
     this.buttonLeft.setAttribute('class', this.buttonClass + ' left');
     this.buttonLeft.setAttribute('href', '#');
+    this.buttonLeft.setAttribute('role', 'button');
+    this.buttonLeft.setAttribute('aria-keyshortcuts', 'Ctrl+Shift+LeftArrow');
     this.buttonRight = document.createElement('a');
     this.buttonRight.setAttribute('class', this.buttonClass + ' right');
     this.buttonRight.setAttribute('href', '#');
+    this.buttonRight.setAttribute('role', 'button');
+    this.buttonRight.setAttribute('aria-keyshortcuts', 'Ctrl+Shift+RightArrow');
 
     if (this.audioSupport) {
         this.init();
@@ -46,6 +50,7 @@ FluidbookAudioDescription.prototype = {
 
         // Add tooltips
         buttons.attr('data-tooltip', this.fluidbook.l10n.__('listen to the page'));
+        buttons.attr('aria-label', this.fluidbook.l10n.__('listen to the page'));
 
         // Hide buttons by default - they will be shown if there is audio when setupPages() is run
         buttons.hide();
index 3f199051b6e7cdfb882279f03a1e3325039a2aab..5be748e7da414e49a9a37b2c0786387e759688b7 100644 (file)
@@ -403,14 +403,14 @@ FluidbookBookmarks.prototype = {
         }
 
         bookmarks += "<a href=\"#\" class=\"bookmark " + side + "\" data-page=\"" + pageNr + "\"";
-        bookmarks += ' data-keyshortcuts="' + shortcut + '"'
+        bookmarks += ' aria-keyshortcuts="' + shortcut + '" role="button"'
         if (this.isBookmarked(pageNr)) {
             bookmarks += " data-enabled=\"enabled\"";
             bookmarks += " data-tooltip=\"" + this._txtRemove + "\"";
             bookmarks += " aria-label=\"" + this._txtRemove + "\"";
         } else {
             bookmarks += " data-tooltip=\"" + this._txtAdd + "\"";
-            bookmarks += " aria-label\"" + this._txtAdd + "\"";
+            bookmarks += " aria-label=\"" + this._txtAdd + "\"";
         }
 
         bookmarks += '>' + getSpriteIcon('bookmark-corner') + '</a>';
index e29a49e9a2e7f527609766b60e44d9364fa6a210..63218e3f9ec7b1d61ca677309b018b80a3a2f92c 100644 (file)
@@ -22,6 +22,27 @@ FluidbookL10N.prototype = {
         }
     },
 
+    translateAttributes: function () {
+        var $this=this;
+        var attrs = ['data-tooltip', 'aria-label'];
+        var selectors = [];
+        $.each(attrs, function (k, attr) {
+            selectors.push('[' + attr + ']');
+        });
+
+        $(selectors.join(',')).each(function () {
+            var e = this;
+            $.each(attrs, function (k, attr) {
+                if ($(e).is('[' + attr + ']')) {
+                    var attrValue=$(e).attr(attr);
+                    if(attrValue.substr(0, 1) === '~'){
+                        $(e).attr(attr, $this.fluidbook.l10n.__(attrValue.substring(1)));
+                    }
+                }
+            })
+        });
+    },
+
     load: function () {
         this.dir = this.getLanguageDirection(this.getActiveLang());
         this.ltr = (this.dir == 'ltr');
index bab33305624dc3d5dc10ff946c0b318b77723655..d3a6ab45d30f079a2d633637adc6f8967f265314 100644 (file)
@@ -277,6 +277,7 @@ FluidbookLinks.prototype = {
             $this.fluidbook.initVideos();
             $this.initInlineSlideshows();
             $this.initAnimatedContentsLinks();
+            $this.fluidbook.l10n.translateAttributes();
         }, 200);
 
 
index 8f4c3ecf7fdc0f924bc6b19e9c67daa6bdd4d07e..406d565887e20469f4d403d185bb84dc75cfe9e3 100644 (file)
@@ -664,6 +664,7 @@ FluidbookLoader.prototype = {
             callback();
         }
         var res = $(img);
+        $(res).attr('aria-hidden', true);
         if (page !== null) {
             $(res).attr('data-page', page);
             $("#loadedcontents").append(res);
index e2f8257dec0a73f1471c071591d57242615737ee..b4e0fc3dfbff3748d3bd2145ac817fee42cb2acc 100644 (file)
@@ -273,7 +273,7 @@ FluidbookMenu.prototype = {
         } else {
             c = ' ' + c;
         }
-        return '<a href="#/closeview" aria-label="' + this.fluidbook.l10n.__('close') + '" aria-keyshortcuts="Escape" class="button back' + c + '">' + getSpriteIcon('interface-close') + '</a>';
+        return '<a href="#/closeview" role="button" aria-label="' + this.fluidbook.l10n.__('close') + '" aria-keyshortcuts="Escape" class="button back' + c + '">' + getSpriteIcon('interface-close') + '</a>';
     }
     ,
     openAudio: function (audio, callback) {
index 3e4465cd837459668e2d6ce05e7336003013fa61..668b8e6f8db96cf33b35064a7d8b7acac0356635 100644 (file)
@@ -188,6 +188,7 @@ FluidbookNav.prototype = {
             res += ' class="' + className + '"';
         }
 
+        res+=' role="button"';
         // Only the horizontal icon menu should have the tooltips
         if (help !== undefined && help !== '') {
             if (navType === 'horizontalNav') {
index a6a4e70b8c588eb2d15a39b62bf081fcd988583e..4315a7286efdbd4c6c6399a27e267ea2895d1894 100644 (file)
@@ -66,11 +66,11 @@ FluidbookSearch.prototype = {
         html += '<div class="searchResultsNavQuery"></div>';
         html += '</div>'; // .searchResultsNavField
         html += '<div class="searchResultsNavArrows">';
-        html += '<div class="button searchResultsPrev" aria-label="' + this.fluidbook.l10n.__('previous result') + '" aria-keyshortcuts="Shift+F3"></div>';
+        html += '<div class="button searchResultsPrev" role="button" aria-label="' + this.fluidbook.l10n.__('previous result') + '" aria-keyshortcuts="Shift+F3"></div>';
         html += '<div class="searchResultsNavCounter"></div>';
-        html += '<div class="button searchResultsNext" aria-label="' + this.fluidbook.l10n.__('next result') + '" aria-keyshortcuts="F3"></div>';
+        html += '<div class="button searchResultsNext" role="button" aria-label="' + this.fluidbook.l10n.__('next result') + '" aria-keyshortcuts="F3"></div>';
         html += '</div>'; // .searchResultsNavArrows
-        html += '<div class="button searchResultsNavClose" aria-label="' + this.fluidbook.l10n.__('close') + '" aria-keyshortcuts="Escape">';
+        html += '<div class="button searchResultsNavClose" role="button" aria-label="' + this.fluidbook.l10n.__('close') + '" aria-keyshortcuts="Escape">';
         html += getSpriteIcon('interface-close');
         html += '</div>'; // .searchResultsNavClose
         html += '</div>'; // #searchResultsNav
index 068450d8b1c52839317a658e3c215ff2b543b9ac..356eb694e5da5a130d99500193bc3199b15f44c4 100644 (file)
@@ -24,7 +24,7 @@ FluidbookTooltip.prototype = {
             $this.eventTriggered(this);
         });
 
-        $("body").append('<div id="tooltip"></div>');
+        $("body").append('<div id="tooltip" aria-hidden="true"></div>');
     },
 
     updateMousePosition: function (e) {
index 68a485ddb75541b3951760a56b50bd08d47c1d91..ed88532ee100fd2a4a5aaaf0329db5a2d6a1b8e7 100644 (file)
@@ -214,7 +214,7 @@ FluidbookLinksZoom.prototype = {
                 }
                 menu += '</div></div>';
                 $groupWrapper.append('<div id="zoomPopupBackground"><div class="bg"></div></div>' + menu);
-                $groupWrapper.append('<a href="#" class="zoomPopupClose" aria-label="'+$this.fluidbook.l10n.__('close')+'" aria-keyshortcuts="Escape">' + getSpriteIcon('interface-close') + '</a>');
+                $groupWrapper.append('<a href="#" role="button" class="zoomPopupClose" aria-label="'+$this.fluidbook.l10n.__('close')+'" aria-keyshortcuts="Escape">' + getSpriteIcon('interface-close') + '</a>');
             }
 
             var z = $('#zoomPopup_' + zoomID),