If time and resources permit, please consider adding the autofocus option to Netlify's frontend bundle. At the moment, this is what I'm doing instead (improvements by JavaScript wizards welcome!):
<script>
// Wait 250ms before setting focus on the input element
setTimeout(function() {
// Get the input element
const input = document.querySelector('input');
// Focus on the input element
input.focus();
}, 250);
</script>
If time and resources permit, please consider adding the autofocus option to Netlify's frontend bundle. At the moment, this is what I'm doing instead (improvements by JavaScript wizards welcome!):