Button elements lose focus when Enter key is pressed

Fixed Issue #12442384


Jun 22, 2017
This issue is public.
Found in
  • Microsoft Edge
Found in build #
Reported by 2 people

Sign in to watch or report this issue.

Steps to reproduce

Bug Overview
Found a nasty little bug in Edge that affects standard Enter key behavior for <button> elements: If you move focus to a <button> instance after having been previously focused in a contenteditable DIV, pressing Enter will direct focus back to the contenteditable DIV and add a line break.

Interestingly this bug is unique to the <button> element. Buttons created via <input type="button"> don’t exhibit this bug. This bug is also unique to Edge and is breaking standard keyboard behavior for buttons. IE 11, Chrome, Safari and Firefox don’t have this issue.

Expected behavior:
When a <button> has focus, pressing Enter should trigger the click event on the <button> and focus should remain on the button.

Steps to reproduce:

  1. Open https://codepen.io/toddlr/pen/EXXMZz in Edge
  2. Move focus into the contenteditable DIV
  3. Press Shift + Tab until you move focus to the button labeled “Button 1”
  4. Press the Enter
  5. Observe how onkeydown focus was forwarded back to the contenteditable DIV and a line break was added to the contenteditable DIV


0 attachments

    Comments and activity

    • Microsoft Edge Team

      Changed Assigned To to “James M.”

      Changed Assigned To to “Bogdan B.”

      Changed Assigned To to “Grisha L.”

      Changed Status to “Fixed”

    • Hello,

      Thank you for providing this information about the issue. We have confirmed the problem, and we are working on a solution for a future build of Edge. We are presently tracking this issue as a duplicate of an existing internal bug report. We look forward to additional feedback you may have on how we can improve Microsoft Edge.

      Best Wishes,
      The MS Edge Team

    • Hello,

      I am still experiencing this issue in IE 11.192.16299.0 on Windows 10. Once I press Enter on a button, the focus gets lost.

      Are there plans to fix this?

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

    Sign in