title: How to detect key press without using an input tag in Blazor
body: <p>I want to be able to capture keyboard input without using an HTML INPUT tag in Blazor. Once the key is pressed i will display a graphic to represent the letter pressed.</p>
  
  <p>Something like this</p>
  
  <pre><code>@page "/counter"
  @using Microsoft.AspNetCore.Components.Web
  
  &lt;div @onkeypress="e =&gt; KeyPress(e)"&gt;
      Press any letter key
  &lt;/div&gt;
  
  @code {
  
      private void KeyPress(KeyboardEventArgs e)
      {
          var letter = e.Key;
      }
  }
  </code></pre>
  
  <p>The KeyPress method does not appear to be called when I set a breakpoint on it. Any help much appreciated.</p>