From 2693e5e2b614829c0e53afc9545474a7a542c91a Mon Sep 17 00:00:00 2001 From: Tom Byers Date: Fri, 2 Oct 2020 14:30:10 +0100 Subject: [PATCH 1/2] Replace use of Array.from Array.from isn't supported by any version of IE. We still need to convert a nodelist to an array so we can either: 1. include the polyfill for Array.from from core-js 2. use [].slice We don't use Array.from anywhere else so this uses the second one. --- app/assets/javascripts/apiKey.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/apiKey.js b/app/assets/javascripts/apiKey.js index cdd7aaf0e..4d8658a7c 100644 --- a/app/assets/javascripts/apiKey.js +++ b/app/assets/javascripts/apiKey.js @@ -29,9 +29,10 @@ this.getRangeFromElement = function (keyElement) { const range = document.createRange(); + const childNodes = Array.prototype.slice.call(keyElement.childNodes); let prefixIndex = -1; - Array.from(keyElement.childNodes).forEach((el, idx) => { + childNodes.forEach((el, idx) => { if ((el.nodeType === 1) && el.classList.contains('govuk-visually-hidden')) { prefixIndex = idx; } From 678934cf49d76008b786ef8290c7c5128df8c13d Mon Sep 17 00:00:00 2001 From: Tom Byers Date: Fri, 2 Oct 2020 14:56:49 +0100 Subject: [PATCH 2/2] Fix copy-to-clipboard button CSS In a lot of browsers, the static position is 0px anyway so there's no problem. In IE11, the button sits to the left of the paragraph above by default. Setting it in the CSS fixes the issue. --- app/assets/stylesheets/components/api-key.scss | 1 + 1 file changed, 1 insertion(+) diff --git a/app/assets/stylesheets/components/api-key.scss b/app/assets/stylesheets/components/api-key.scss index b481c9558..8ea44a3f1 100644 --- a/app/assets/stylesheets/components/api-key.scss +++ b/app/assets/stylesheets/components/api-key.scss @@ -22,6 +22,7 @@ position: absolute; bottom: 2px; + left: 0px; &:active { top: auto;