shipshapecode / tether

A positioning engine to make overlays, tooltips and dropdowns better

Home Page:https://tetherjs.dev/docs/welcome

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unexpected behavior when element is larger than target

Justineo opened this issue · comments

tether-mid

It's a case on http://tether.io/ with a little modification (I tweaked the size of the target element a little bit and made the window horizontally scrollable):

new Tether({
  element: yellowBox,
  target: greenBox,
  attachment: 'top left',
  targetAttachment: 'bottom left',
  constraints: [
    {
      to: 'window',
      attachment: 'together'
    }
  ]
});

As you can see, Tether isn't handling such constraint correctly on horizontal direction: it isn't flipping the element when there is enough space on the left when its right side is out of window's right border, and when it goes out of window's left border, it flipped unexpectedly.