ocadotechnology / hexagonjs

A modular, themable collection of components for modern browsers
https://www.hexagonjs.io
Apache License 2.0
51 stars 15 forks source link

Dropdown: initial positioning sometimes displays incorrectly #550

Closed charlieTheBotDev closed 4 years ago

charlieTheBotDev commented 5 years ago

Context

When opening a dropdown for the first time it sometimes displays in an incorrect position.

Steps to Reproduce

Unable to reliably reproduce, except with some screenshot testing (which is difficult to debug)

Your Environment

p-koscielniak commented 5 years ago

Hi This issue is caused by using position: absolute; bottom: **px instead of position: absolute; top: **px for dropdown positioning.

bottom positioning shouldn't be used because resizing window or changing viewport orientation changes dropdown position.

Removing:

    if direction is 'up'
      yPos = 'bottom'
      y = document.body.clientHeight - y - dropdownRect.height

fixes flaky BackstopJS tests.