factored out component registration/construction boilerplate; added support for enter/esc when editing