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

Commit

Permalink
Add param to make webchat link not focusable
Browse files Browse the repository at this point in the history
  • Loading branch information
LucaDelBuono committed Jun 4, 2019
1 parent 0634cc2 commit 2470dde
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion assets/javascript/hmcts-webchat.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ function parseText(text) {
}

function webchat_init(customParams) {
const version = '0.1.15';
const version = '0.1.16';

const defaultParams = {
uuid: '',
Expand All @@ -24,6 +24,7 @@ function webchat_init(customParams) {
additionalTextClosed : 'The web chat is now closed. Come back Monday to Friday 9:30am to 5pm.\nOr contact us using one of the ways below.',
additionalTextChatAlreadyOpen: 'A web chat window is already open.',
linkTextAgent: 'Start web chat (opens in a new window)',
chatLinkFocusable: true,
btnNoAgents: '/aG1jdHNzdGFnaW5nMDE/button_7732814745cac6f4603c4d1.53357933/img/logo',
btnAgentsBusy: '/aG1jdHNzdGFnaW5nMDE/button_2042157415cc19c95669039.65793052/img/logo',
btnServiceClosed: '/aG1jdHNzdGFnaW5nMDE/button_20199488815cc1a89e0861d5.73103009/img/logo'
Expand All @@ -48,6 +49,7 @@ function webchat_init(customParams) {
chatDownAction: params.chatDownAction,
chatDownText: params.chatDownText,
additionalText: params.additionalText,
chatLinkFocusable: params.chatLinkFocusable,
onInit: function(bus) {
window.bus = bus;

Expand All @@ -56,6 +58,10 @@ function webchat_init(customParams) {
const chatImg = document.querySelector('#' + window.__8x8Chat.buttonContainerId + ' img');
const chatLink = document.querySelector('#' + window.__8x8Chat.buttonContainerId + ' a');

if (!window.__8x8Chat.chatLinkFocusable) {
chatLink.setAttribute('tabindex', '-1');
}

if (chatImg) {
const chatImgBtn = chatImg.src.split('CHAT')[1];
const paragraph = document.createElement('p');
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.1.15",
"version": "0.1.16",
"description": "Assets to support HMCTS CTSC web chat",
"repository": {
"type": "git",
Expand Down

0 comments on commit 2470dde

Please sign in to comment.