Tried the following and they doesn't seem compatible.
Is there a workaround to be able to prevent Enter, ESC & click outside the Toast popup box? So the users must have to wait for the popup to close to do anything.
try to catch event and disable it with event.preventDefault ()
document.write("press a key")
document.addEventListener("keypress",(e)=>{
if(e.keyCode==27 || e.keyCode==13){
e.preventDefault()
alert(" you can't press esc or enter")
}
else document.write("key press:"+e.keyCode)
})
document.addEventListener("click",(e)=>{
if(e.path[0].className!=="myAlert"){
e.preventDefault()
alert("you can't press out")
}
})
.myAlert{
width: 100px;
height: 100px;
background: red;
color: white;
text-alin
}
<div class="myAlert">
Click me
</div>