Would need more information about your markup, but if you want to keep the autocomplete, maybe you can solve it by simply adding a :hover
to the form itself, the autocomplete-suggestions are some kind of shadow-DOM of the input, e.g. it would be contained within the form/input itself, so something like this might help:
.subscribe-popup .subscribe-form {
opacity: 0;
visibility: hidden;
}
.subscribe-popup:hover .subscribe-form,
.subscribe-popup:active .subscribe-form,
.subscribe-form:hover { /* this is new */
visibility: visible;
opacity: .95;
}
EDIT: After markup was provided I could fiddle around a bit and it seems the only way of preventing the flickering is to replace the :hover
on the form with :focus-within
, that seems to work BUT, no IE (neither the beloved old one nor Edge) do support it, so if you need support for these you likely need JS and then you could handle the entire interaction with JS anyways! OR you could try something like this polyfill for :focus-within
(or maybe you don't want IE-users as subscribers anyways? =D)
.subscribe-popup .subscribe-form {
opacity: 0;
visibility: hidden;
}
.subscribe-popup:hover .subscribe-form,
.subscribe-popup:active .subscribe-form,
.subscribe-form:focus-within {
visibility: visible;
opacity: .95;
}
<div class="subscribe-popup desktop-only">
<span class="subscribe-cta">join our mailing list</span>
<div class="subscribe-form">
<div id="mc_embed_signup">
<form id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate="">
<div id="mc_embed_signup_scroll">
<div class="mc-field-group">
<label for="mce-EMAIL">Email Address: <span class="asterisk">*</span></label>
<input type="email" value="" name="EMAIL" class="required email" id="mce-EMAIL">
</div>
<!-- etc. -->
<div class="clear"><input type="submit" class="button" value="Subscribe" name="subscribe" id="mc-embedded-subscribe"></div>
</div>
</form>
</div>
</div>
</div>
a possible CSS-only alternative could be to make users of browser with no support for :focus-within
click the subscribe link instead of just hovering it (which is probably what they will do anyways if nothing happens, just an assumption of course). Requires support for the general sibling combinator-selector which is widely supported (IE7+, everybody else):
.form-toggle {
/* just make it invisible but not inaccessible */
border: 0;
clip: rect(1px, 1px, 1px, 1px);
height: 1px;
outline: none;
overflow: hidden;
padding: 0;
position: absolute;
width: 1px;
}
.subscribe-popup .subscribe-form {
opacity: 0;
visibility: hidden;
}
.subscribe-popup:hover .subscribe-form,
.subscribe-popup:active .subscribe-form,
.form-toggle:checked ~ .subscribe-form,
.subscribe-form:focus-within {
visibility: visible;
opacity: .95;
}
<div class="subscribe-popup desktop-only">
<input class="form-toggle" type="checkbox" id="form-toggle" />
<label class="subscribe-cta" for="form-toggle">join our mailing list</label>
<div class="subscribe-form">
<div id="mc_embed_signup">
<form id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate="">
<div id="mc_embed_signup_scroll">
<div class="mc-field-group">
<label for="mce-EMAIL">Email Address: <span class="asterisk">*</span></label>
<input type="email" value="" name="EMAIL" class="required email" id="mce-EMAIL">
</div>
<!-- etc. -->
<div class="clear"><input type="submit" class="button" value="Subscribe" name="subscribe" id="mc-embedded-subscribe"></div>
</div>
</form>
</div>
</div>
</div>