Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Menu does render on wrong position when trigger is an Avatar element #443

Open
xeinebiu opened this issue Sep 27, 2024 · 1 comment

Comments

@xeinebiu
Copy link

xeinebiu commented Sep 27, 2024

    <HStack>
      <Spacer />
      <Menu.Root>
        <Menu.Trigger asChild>
          <Avatar name="Hello World" />
        </Menu.Trigger>
        <Menu.Positioner>
          <Menu.Content>
            <Menu.Item value="react">React</Menu.Item>
            <Menu.Item value="solid">Solid</Menu.Item>
            <Menu.Item value="vue">Vue</Menu.Item>
          </Menu.Content>
        </Menu.Positioner>
      </Menu.Root>
    </HStack>

image
image


Expected Behavior

It should work the same as when using a Button as trigger
image

    <HStack>
      <Spacer />
      <Menu.Root>
        <Menu.Trigger asChild>
          <Button variant="outline">Open Menu</Button>
        </Menu.Trigger>
        <Menu.Positioner>
          <Menu.Content>
            <Menu.Item value="react">React</Menu.Item>
            <Menu.Item value="solid">Solid</Menu.Item>
            <Menu.Item value="vue">Vue</Menu.Item>
          </Menu.Content>
        </Menu.Positioner>
      </Menu.Root>
    </HStack>
@xeinebiu
Copy link
Author

Removing the asChild does fix the issue with the Avatar

   <HStack>
      <Spacer />
      <Menu.Root>
        <Menu.Trigger asChild>  <-- Remove asChild 
          <Avatar name="Hello World" />
        </Menu.Trigger>
        <Menu.Positioner>
          <Menu.Content>
            <Menu.Item value="react">React</Menu.Item>
            <Menu.Item value="solid">Solid</Menu.Item>
            <Menu.Item value="vue">Vue</Menu.Item>
          </Menu.Content>
        </Menu.Positioner>
      </Menu.Root>
    </HStack>

Though I am not sure if this is intended or a bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant