Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

submit button won't activate on 'enter' key

$
0
0

I have this element

<button type="submit" tabindex="0" autofocus="autofocus"         @onclick="StartClick">Start</button>

I want it to trigger on pressing the enter key, but nothing happens.

I've tried wrapping it in a form. No change.

The nav bar on the left has initial focus.

If I put a text box next to it and manually give it focus, the button still doesn't trigger the onclick event.

If I tab to the button, then hit enter, it does trigger.
So I don't think an onkeypress is going to help.

Do I need to give it focus?

Seems like the whole point of 'type=submit' is that it should work regardless of focus.

Trying to do this without resorting to Javascript.


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>