Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Parent element loses hover on select of a dropdown

I get a strange behavior by Google Chrome 33 (Ubuntu).

I have a div element, which gets resized and repositioned on hover. Underlying there is a <select> element. When I try to select an option the :hover state of the parent div is lost.

I can't reproduce this in Firefox or Opera.

jsFiddle

demo

like image 944
dan-lee Avatar asked Feb 02 '26 15:02

dan-lee


1 Answers

This seems to be a known Chromium issue: https://code.google.com/p/chromium/issues/detail?id=78994

My workaround requires a hover CSS class + Javascript, as CSS parent selectors aren't a thing:

$('select').on('focus', function() {
    $(this).parent().addClass('hovered');
}).on('blur', function() {
    $(this).parent().removeClass('hovered');
});
like image 173
dan-lee Avatar answered Feb 05 '26 07:02

dan-lee



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!