Giter VIP home page Giter VIP logo

Comments (5)

LFDanLu avatar LFDanLu commented on July 24, 2024

Definitely strange, I don't see anything particularly different between the Group and the Input/Button elements that would cause this difference in behavior, will need to dig into what in useOverlayPosition is causing this positioning.

from react-spectrum.

ozguruysal avatar ozguruysal commented on July 24, 2024

For now I'm using this workaround.

const groupRef = React.useRef<HTMLDivElement>(null);
const triggerRef = React.useRef<HTMLDivElement | null>(null);

React.useLayoutEffect(() => {
  if (groupRef.current) {
    triggerRef.current = groupRef.current;
  }
}, []);

<ComboBox>
  <Group ref={groupRef}>
    ...
  </Group>
  <Popover triggerRef={triggerRef}>
      ...
  </Popover>
</ComboBox>

from react-spectrum.

snowystinger avatar snowystinger commented on July 24, 2024

Seems to have something to do with what runs on the server vs what runs on the client. I don't know enough about Remix, but does it work if you turn it into a client only component? (don't know if that exists in Remix)

From what I can tell though, this isn't something related to RAC

from react-spectrum.

ozguruysal avatar ozguruysal commented on July 24, 2024

@snowystinger Remix doesn't have server components. I tested also with Next.js that has server components and added 'use client' directive. It wouldn't work without it anyways, and the same issue is there too. Here's the link.

https://stackblitz.com/edit/stackblitz-starters-xjutyc?file=app%2FComboBox.tsx

As @LFDanLu mentioned, the strange thing is that it works fine when you set the trigger element as the Button for example. That's why it feels like a RAC issue.

from react-spectrum.

snowystinger avatar snowystinger commented on July 24, 2024

It's odd because Group is even more simple than Button, so I can't imagine why the ref is not defined once you get to that first effect.

I asked about the server vs client because I saw this https://remix.run/docs/en/main/discussion/server-vs-client#splitting-up-client-and-server-code

I don't know how their magic splitting works.

It's good that it happens in Next.js though, I think we can go back to suspecting RAC.

I thought maybe the order in which renders/refs/effects ran in children/siblings might be a culprit, but then I would expect this to affect non-SSR as well. I also would expect that adding a wrapper around Group would solve it, and that didn't do anything. So I think we can rule that out as well.

from react-spectrum.

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.