disables page scroll when pressing spacebar
This commit is contained in:
parent
8b68932997
commit
b5f3ac0526
1 changed files with 11 additions and 0 deletions
|
@ -161,6 +161,17 @@ function App(props: Props) {
|
|||
return () => window.removeEventListener('mouseup', handleForwardAndBackButtons);
|
||||
});
|
||||
|
||||
// allows user to pause miniplayer using the spacebar without the page scrolling down
|
||||
useEffect(() => {
|
||||
const handleKeyPress = e => {
|
||||
if (e.key === ' ' && e.target === document.body) {
|
||||
e.preventDefault();
|
||||
}
|
||||
};
|
||||
window.addEventListener('keydown', handleKeyPress);
|
||||
return () => window.removeEventListener('keydown', handleKeyPress);
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
if (referredRewardAvailable && sanitizedReferrerParam && isRewardApproved) {
|
||||
setReferrer(sanitizedReferrerParam, true);
|
||||
|
|
Loading…
Reference in a new issue