Microsoft Edge freezes when focus changes quickly and from within a setTimeout.

Not reproducible Issue #14280302

Details

Author
Christopher S.
Created
Oct 17, 2017
Privacy
This issue is public.
Found in
  • Microsoft Edge
Reports
Reported by 1 person

Sign in to watch or report this issue.

Steps to reproduce

There seems to be an issue in Edge that occurs when focusing an element from within a setTimeout. The code below will cause Edge to freeze if you select one of the elements and then hold down a key. Focus will toggle between the two elements until the browser freezes. The only way to unfreeze the browser is by clicking somewhere outside of the page. This seems to require one of the elements to be a text field and the calls to focus need to be within a setTimeout.

<html>
  <head>
    <title>Focus Input on Timeout Problem Demo</title>
    <style>
      *:focus {
        outline: solid red 2px;
      }

      #div {
        background-color: blue;
        height: 100px;
        width: 100px;
      }
    </style>
    <script>
      var toggle = true;
      function switchFocus(e) {
        var div = document.getElementById("div");
        var input = document.getElementById("input");
        
        if(e.target === input) {
          setTimeout(function() {
            div.focus();
          },0);
        } else {
          setTimeout(function() {
            input.focus();
          },0);
        }
        toggle = !toggle;
      }
    </script>
  </head>
  <body>
    <div onkeydown="switchFocus(arguments[0])"> 
      <div id="div" tabIndex="0"></div>

      <input id="input" type="text"></input>
    </div>
  </body>
</html>

Attachments

1 attachment

Comments and activity

  • Microsoft Edge Team

    Changed Assigned To to “James M.”

  • Hello,

    Thank you for providing this information about the issue. After thorough testing, we are unable to reproduce this problem in Edge. Please test this behavior in our latest public stable build 15063 or the insider build 17017.

    Best Wishes,
    The MS Edge Team

  • Microsoft Edge Team

    Changed Status to “Not reproducible”

You need to sign in to your Microsoft account to add a comment.

Sign in