Merge pull request #3665 from alphagov/fix-bug-with-copy-to-clipboard

Fix bug with copy to clipboard
This commit is contained in:
Tom Byers
2020-10-02 17:33:42 +01:00
committed by GitHub
2 changed files with 3 additions and 1 deletions
+2 -1
View File
@@ -29,9 +29,10 @@
this.getRangeFromElement = function (keyElement) { this.getRangeFromElement = function (keyElement) {
const range = document.createRange(); const range = document.createRange();
const childNodes = Array.prototype.slice.call(keyElement.childNodes);
let prefixIndex = -1; let prefixIndex = -1;
Array.from(keyElement.childNodes).forEach((el, idx) => { childNodes.forEach((el, idx) => {
if ((el.nodeType === 1) && el.classList.contains('govuk-visually-hidden')) { if ((el.nodeType === 1) && el.classList.contains('govuk-visually-hidden')) {
prefixIndex = idx; prefixIndex = idx;
} }
@@ -22,6 +22,7 @@
position: absolute; position: absolute;
bottom: 2px; bottom: 2px;
left: 0px;
&:active { &:active {
top: auto; top: auto;