Custom modules edit on hover when sending new email


I have created custom module for header and footer and they are included in my coded file, but I get these two blocks at the top instead of ‘Edit’ when hovered over header or footer.

It’s included in my ‘Coded file’ like:

{% custom_widget "footer" widget_name="Footer (Email)" %}

Similar problem I have with a ‘Section Title’ custom module. When I hover over it I can’t get ‘Edit module’ to show but instead I need to search for this module in module list. Thing is that some of them are working and few of them are not.

I’m not sure what I’m doing wrong.