The code to detect overlap only works when an element is scrolled into view. This isn't at all necessary, and is a hold-over from before axe-core was using a grid to test color-contrast. You can tell by looking at something like the following, which reports #target as overlapped when scrolled into view, but ignores the overlapping element when it's not in view.
<div style="height: 1em; overflow: auto; background: cyan;">
<div style="background: rgba(0,255,255,0.6); margin-bottom: -1em; height: 1em; position:relative;"></div>
<div id="target">foo</div>
</div>
I haven't seen this produce false positives, but in theory it can. The more problematic part is that it changes the result, based on where in the page the scroll happens.
The code to detect overlap only works when an element is scrolled into view. This isn't at all necessary, and is a hold-over from before axe-core was using a grid to test color-contrast. You can tell by looking at something like the following, which reports
#targetas overlapped when scrolled into view, but ignores the overlapping element when it's not in view.I haven't seen this produce false positives, but in theory it can. The more problematic part is that it changes the result, based on where in the page the scroll happens.