Skip to content
This repository has been archived by the owner on Oct 25, 2021. It is now read-only.

Commit

Permalink
Add tabindex=-1 to save button when ribbon is closed for accessibility
Browse files Browse the repository at this point in the history
  • Loading branch information
LucaDelBuono committed Jul 31, 2019
1 parent f5f9278 commit d85df8b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
18 changes: 18 additions & 0 deletions assets/javascript/hmcts-webchat-busHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ if (!String.prototype.startsWith) {
addAriaLabelAttributeToTitles();
addAriaLabelAttributeToButtons();
addAriaLabelAndPlaceholderAttributesToPreChatFields();
toggleSaveAccessibility();
}

function removeUnusedContainers(containers) {
Expand Down Expand Up @@ -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();
Expand All @@ -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);
2 changes: 1 addition & 1 deletion assets/javascript/hmcts-webchat.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down

0 comments on commit d85df8b

Please sign in to comment.