diff --git a/assets/javascript/hmcts-webchat-busHandler.js b/assets/javascript/hmcts-webchat-busHandler.js index 3412fe2..ee7fb81 100644 --- a/assets/javascript/hmcts-webchat-busHandler.js +++ b/assets/javascript/hmcts-webchat-busHandler.js @@ -67,6 +67,7 @@ if (!String.prototype.startsWith) { addAriaLabelAttributeToTitles(); addAriaLabelAttributeToButtons(); addAriaLabelAndPlaceholderAttributesToPreChatFields(); + toggleSaveAccessibility(); } function removeUnusedContainers(containers) { @@ -226,6 +227,8 @@ if (!String.prototype.startsWith) { function toggleActions(action) { const $actionElement = jQuery('.actions'); + const saveButton = document.querySelector('.action-save'); + switch(action) { case 'hide': jQuery('.action-clear').remove(); @@ -235,7 +238,22 @@ if (!String.prototype.startsWith) { break; case 'show': $actionElement.show(); + saveButton.setAttribute('tabindex', '-1'); break; } } + + function toggleSaveAccessibility() { + const saveButton = document.querySelector('.action-save'); + + jQuery('.flag').on('click', function() { + setTimeout(function() { + if (parseInt(jQuery('.message-actions').css('top')) === 0) { + saveButton.removeAttribute('tabindex'); + } else { + saveButton.setAttribute('tabindex', '-1'); + } + }, 750); + }); + } })(this); diff --git a/assets/javascript/hmcts-webchat.js b/assets/javascript/hmcts-webchat.js index 267611c..06e0b2b 100644 --- a/assets/javascript/hmcts-webchat.js +++ b/assets/javascript/hmcts-webchat.js @@ -44,7 +44,7 @@ function parseText(text) { } function webchat_init(customParams) { - const version = '0.3.0'; + const version = '0.3.1'; const requiredParams = [ 'uuid', 'tenant', diff --git a/package.json b/package.json index f0112ca..4c23b22 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@hmcts/ctsc-web-chat", - "version": "0.3.0", + "version": "0.3.1", "description": "HMCTS CTSC Web Chat", "repository": { "type": "git",