This should be baked into the Gutenberg Block Editor by default. I almost get annoyed anytime I’m working on a site without it. Save yourself some clicks, honey!

This should be baked into the Gutenberg Block Editor by default. I almost get annoyed anytime I’m working on a site without it. Save yourself some clicks, honey!
<?php
// Block Editor: Select on Enter in the Block Inserter
// https://snipsnip.pro/s/180
namespace FhkH6D;
function block_editor_select_on_enter(){
if ( !function_exists( '\get_current_screen' ) ) { return false; }
$screen = \get_current_screen();
if ( method_exists( $screen, 'is_block_editor' ) && $screen->is_block_editor() ) {
?>
<script>
const FhkH6D_domReady = cb => {
"interactive" === document.readyState ||
"complete" === document.readyState ?
cb() : document.addEventListener("DOMContentLoaded", cb)
};
FhkH6D_domReady(() => {
document.addEventListener("keypress", function(event) {
if (event.target.classList.contains("components-search-control__input") && "Enter" === event.key) {
let el = document.querySelector("div.block-editor-inserter__panel-content > div.block-editor-block-types-list > div > div.block-editor-block-types-list__list-item");
el && el.firstElementChild.focus()
}
})
});
console.log('Block Editor: Select on Enter in the Block Inserter');
</script>
<?php
}
}
\add_action( 'admin_print_footer_scripts', '\FhkH6D\block_editor_select_on_enter' );