When entering the full screen state, why does pressing ESC not respond?

as the title shows, I tried not to get the event of pressing esc in full screen. How to solve the problem?

Jul.22,2021


window.onresize = function(){
  if(!checkFull()){
   //do something
  }
}

function checkFull(){
  var isFull = document.fullscreenEnabled || window.fullScreen || document.webkitIsFullScreen || document.msFullscreenEnabled;
  if(isFull === undefined) isFull = false;
  return isFull;
}

Esc is used as a hotkey to leave the full screen, when js code does not receive esc events.

Menu