Bug 73068 - css :hover doesn't work on initially onscreen absolute positioned divs with negative z-index
Summary: css :hover doesn't work on initially onscreen absolute positioned divs with n...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: UI Events (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2011-11-23 21:03 PST by Mike Lawther
Modified: 2022-07-11 16:47 PDT (History)
3 users (show)

See Also:


Attachments
Testcase (303 bytes, text/html)
2011-11-28 11:41 PST, Simon Fraser (smfr)
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Lawther 2011-11-23 21:03:34 PST
As reported at http://code.google.com/p/chromium/issues/detail?id=83533;

An absolutely positioned div with a negative zindex that is initially visible without scrolling doesn't have hover applied to it.

----------
<style>
div {
    width: 50px;
    height: 50px;
    position: absolute;
    background-color: blue;
    z-index: -1;
}

div:hover {
	background-color:green;
}
</style>   

<div style="top: 200px;"></div>
<div style="top: 400px;"></div>
<div style="top: 600px;"></div>
<div style="top: 800px;"></div>
------------

In the above testcase, any div that is initially offscreen (ie requiring scrolling) will correctly turn green on hover. The ones that are initially onscreen don't.

Note you need to load this directly - pasting into something like jsfiddle.net does not repro the problem.

Browsers Tested (MacOS):
 - WebKit Nightly r101106: BAD
 - Firefox 8.0 : OK
 - Opera 11.52: OK
Comment 1 Alexey Proskuryakov 2011-11-24 12:52:09 PST
See also: bug 25943.
Comment 2 Simon Fraser (smfr) 2011-11-28 11:41:32 PST
Created attachment 116794 [details]
Testcase
Comment 3 Brent Fulgham 2022-07-11 16:47:48 PDT
This continues to be an issue in 2022. Blink and WebKit have the same (broken) behavior.
Comment 4 Radar WebKit Bug Importer 2022-07-11 16:47:58 PDT
<rdar://problem/96850674>