Skip to content

Commit

Permalink
Change keydown to keyup
Browse files Browse the repository at this point in the history
  • Loading branch information
owenatgov committed Oct 24, 2022
1 parent 98611be commit 18d9c89
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/govuk/components/hide-this-page/hide-this-page.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ HideThisPage.prototype.handleEscKeypress = function (e) {

if (this.escCounter >= 3) {
this.escCounter = 0
this.firstButton.click()
this.updateSpan.innerText = 'Exit this page activated'
window.location.href = this.firstButton.href
} else {
this.updateSpan.innerText = 'Exit this Page key press ' + this.escCounter + ' of 3'
}
Expand All @@ -59,7 +60,7 @@ HideThisPage.prototype.setEscTimer = function () {
HideThisPage.prototype.init = function () {
this.initUpdateSpan()
this.initButtonClickHandler()
document.addEventListener('keydown', this.handleEscKeypress.bind(this), true)
document.addEventListener('keyup', this.handleEscKeypress.bind(this), true)
}

export default HideThisPage

0 comments on commit 18d9c89

Please sign in to comment.