Skip to content

Commit

Permalink
More refining
Browse files Browse the repository at this point in the history
  • Loading branch information
paullewis committed Jul 15, 2016
1 parent 6a33c28 commit fbfb410
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lighthouse-core/driver/gatherers/interstitial.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,13 @@ function getInterstitial() {
.filter(e => {
// Check for position fixed.
const computedStyle = window.getComputedStyle(e);
const isFixed = computedStyle.position === 'fixed';
const isFixedOrAbsolute = computedStyle.position === 'fixed' ||
computedStyle.position === 'absolute';

// Check for nav / drawer / lightbox elements, since these are typically okay.
// Note: overlay is an interesting one, since it *might* be valid here, such as in the case
// of social media post deeplinks. However it seems to be the "go to" name for an interstitial
// so on that basis it should probably be left out.
const regExpValidOverlays = /menu|nav|sidebar|drawer|lightbox/i;
const isValidOverlay = regExpValidOverlays.test(e.className) ||
regExpValidOverlays.test(e.id) ||
Expand All @@ -48,9 +52,9 @@ function getInterstitial() {
// Check it's clickable.
const isClickable = computedStyle.pointerEvents !== 'none';

// Only allow through fixed, non-nav/lightbox elements whose size makes them cover
// Only allow through fixed / absolute, non-nav/lightbox elements whose size makes them cover
// over 50% of the available viewport, and are visible and clickable.
return isClickable && isVisible && isFixed && !isValidOverlay && isCoveringViewport;
return isClickable && isVisible && isFixedOrAbsolute && !isValidOverlay && isCoveringViewport;
});

// __returnResults is injected by evaluateAsync for passing back the result.
Expand Down

0 comments on commit fbfb410

Please sign in to comment.