mirror of https://github.com/crossplane/docs.git
Additional keyboard accessibility for Slack popup
Signed-off-by: Connor Chan <connorjosephchan@gmail.com>
This commit is contained in:
parent
91375fb066
commit
6cfc34597d
|
@ -7,7 +7,15 @@
|
|||
return window.localStorage.getItem('dismissedSlackPopup') === 'true';
|
||||
}
|
||||
|
||||
function handleEscapeKey(e) {
|
||||
if (e.key === 'Escape') {
|
||||
hidePopup();
|
||||
}
|
||||
}
|
||||
|
||||
function hidePopup() {
|
||||
document.removeEventListener('keydown', handleEscapeKey);
|
||||
|
||||
// IE fix
|
||||
document.querySelector('.slack-popup-container').innerHTML = '';
|
||||
|
||||
|
@ -90,6 +98,8 @@
|
|||
popup.appendChild(popupBody);
|
||||
|
||||
document.querySelector('body').appendChild(popup);
|
||||
|
||||
document.addEventListener('keydown', handleEscapeKey);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue