The problem may appear due to improper HTML code used in the widget. One of the common reasons is that non-HTML5 tags are used (like
<gcse:search></gcse:search>
). They should be replaced with valid HTML5 tags (like <div class="gcse-search"></div>
).