Code Monkey home page Code Monkey logo

Comments (5)

atomiks avatar atomiks commented on May 25, 2024 1

Hmm, yeah I see that as well. Not sure what would cause it so will need some investigating.

transform: translate(-50%,-50%)

A new "containing block" gets created in this situation, and most positioning bugs that appear now seem to be related to handling this layout situation

Looks like it's related to collision detection when using shift(). When removing that middleware, it's positioned correctly. One possible workaround is to use an empty boundary shift({ boundary: [] }) instead of the default clippingAncestors. Now it will only detect the root viewport collision instead of the incorrectly-calculated clippingAncestors, which may be fine in many situations with top-layer elements...

from floating-ui.

atomiks avatar atomiks commented on May 25, 2024 1

Yeah most likely the same issue, if you add boundary: [] for hide() as well, it should work. This also goes for autoPlacement, and any other visibility-optimizer ones that perform collision detection.

from floating-ui.

atomiks avatar atomiks commented on May 25, 2024

Is this not correct?
Screenshot 2024-04-15 at 11 55 25 PM

from floating-ui.

ChellappanRajan avatar ChellappanRajan commented on May 25, 2024

Is this not correct? Screenshot 2024-04-15 at 11 55 25 PM

It is working fine on a small screen; however, if I go fullscreen on this page (https://vitejsvitejzzg6c-drf5--5173--7dbe22a9.local-credentialless.webcontainer.io/) and open the drawer, then clicking on the input field to open the panel causes the floating panel's position to be incorrect.

Screenshot 2024-04-15 at 10 26 42 PM

from floating-ui.

ChellappanRajan avatar ChellappanRajan commented on May 25, 2024

Hmm, yeah I see that as well. Not sure what would cause it so will need some investigating.

transform: translate(-50%,-50%)

A new "containing block" gets created in this situation, and most positioning bugs that appear now seem to be related to handling this layout situation

Looks like it's related to collision detection when using shift(). When removing that middleware, it's positioned correctly. One possible workaround is to use an empty boundary shift({ boundary: [] }) instead of the default clippingAncestors. Now it will only detect the root viewport collision instead of the incorrectly-calculated clippingAncestors, which may be fine in many situations with top-layer elements...

Thank you for sharing the workaround. There is one more issue I found in our application regarding the issue with the hide middleware, it seems that it returns 'hide', which might be causing the panel to not open consistently. Do you think this could be related to the same issue you mentioned earlier


If I set the display property based on the hide flag, the panel always remains closed.

export function useFloatingUI(trigger: any, panel: any) {
  computePosition(trigger, panel, {
    middleware: middleware,
    strategy: 'fixed',
  }).then(({ x, y, middlewareData }) => {
    const { hide } = middlewareData;
    Object.assign(panel.style, {
      left: `0px`,
      top: `0px`,
      transform: `translate(${x}px, ${y}px)`,
      // display:hide ? 'none': 'block'
    });
  });
}

from floating-ui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.