Opened 5 years ago

Closed 2 years ago

#1735 closed defect (rejected)

Element Hiding Helper selection not working when all elements are positioned absolutely

Reported by: Khrin Assignee:
Priority: P3 Milestone:
Module: Extensions-for-Adblock-Plus Keywords:
Cc: mapx, trev, greiner Blocked By:
Blocking: Platform: Firefox
Ready: yes Confidential: no
Tester: Verified working:
Review URL(s):

Description (last modified by trev)

Environment

Using the latest version of Element Hiding Helper (on Firefox 35 beta 6, ABP 2.6.6.3881, EHH 1.3.0.472) it's impossible to correctly highlight elements on pages where all elements are positioned absolutely.

How to reproduce

  1. Go to http://www.energyfmsa.co.za/
  2. Open Element Hiding Helper, to select an element on the page.
  3. Look at the red rectangle used to highlight elements.

Observed behaviour

The red rectangle will be stuck at the top of page. This is merely a visualization issue, as it will still be possible to click the element and open the assistant window.

Expected behaviour

The red rectangle should be positioned correctly around the relevant element.

Analysis

Viewport size is being determined incorrectly, document.documentElement.clientHeight returns 0. It obviously doesn't consider all the absolutely positioned elements.

Change History (8)

comment:1 Changed 5 years ago by mapx

  • Cc mapx added
  • Component changed from Unknown to Extensions-for-Adblock-Plus

comment:2 Changed 5 years ago by philll

  • Cc trev added

Highlighting also doesn't show up on other pages like web.de

comment:3 Changed 5 years ago by trev

I can reproduce the reported issue in both Firefox 34 and Firefox 37.0a1 nightly. I cannot see any problem on web.de however.

Version 0, edited 5 years ago by trev (next)

comment:4 Changed 5 years ago by trev

  • Cc greiner added

The problem is that the height of this document is being determined incorrectly. document.documentElement.clientHeight gives 0 because all elements are positioned absolutely. window.innerHeight would give the correct value here but not on websites with a horizontal scrollbar.

Thomas, any idea how we can reliably get viewport size (minus scrollbars)? Special handling for document.documentElement.clientHeight == 0 and falling back to window.innerHeight won't do, as some elements might not be positioned absolutely even if the majority of them is. I'm getting the impression that one needs to track down all absolutely positioned elements and get their position for the correct result.

comment:5 Changed 5 years ago by trev

  • Description modified (diff)
  • Priority changed from Unknown to P3
  • Ready set
  • Summary changed from Element Hiding Helper highlighting bug. to Element Hiding Helper selection not working when all elements are positioned absolutely

comment:6 Changed 5 years ago by greiner

Interestingly, unlike Firefox, Chrome Element.clientHeight does not return 0 and neither does IE 11. The spec defines it as follows:

  1. If the element has no associated CSS layout box or if the CSS layout box is inline, return zero.
  1. If the element is the root element and the element's document is not in quirks mode, or if the element is the HTML body element and the element's document is in quirks mode, return the viewport height excluding the size of a rendered scroll bar (if any).

I didn't find any issues using window.innerHeight when playing around inserting and targeting elements in the page with position: static. It does include the height of the horizontal scrollbar but we are already using window.innerWidth to determine the viewport width.

comment:7 Changed 5 years ago by philll

  • Platform changed from Firefox/Firefox Mobile to Firefox

Made Firefox and Firefox mobile available as seperate platforms.

comment:8 Changed 2 years ago by trev

  • Resolution set to rejected
  • Status changed from new to closed

Mass-closing all bugs in the Extensions for Adblock Plus module, these extensions no longer work as of Adblock Plus 3.0 / Firefox 57.

Note: See TracTickets for help on using tickets.