nextui icon indicating copy to clipboard operation
nextui copied to clipboard

[BUG] - `Avatar` throwing various console errors regarding its `button` `onPress`

Open ndom91 opened this issue 3 years ago • 5 comments

Describe the bug

I'm using an Avatar as the Dropdown.Trigger inside the Navbar, i.e.

<Navbar
  isBordered={false}
  maxWidth="fluid"
  variant={'floating'}
  className="bg-none"
>
  <Navbar.Brand>
    <Avatar squared size="lg" src="/favicon.png" alt="ndo logo" />
  </Navbar.Brand>
  <Navbar.Content>
    <Dropdown placement="bottom-right">
      <Dropdown.Trigger>
        <Avatar
          bordered
          size="lg"
          squared
          zoomed
          as="button"
          color="gradient"
          src={session?.user.image ?? '/favicon.png'}
        />
      </Dropdown.Trigger>
    </Dropdown>
  </Navbar.Content>
</Navbar>

Upon render, I get a few error messages in the console with stack traces pointing at the Avatar within the Dropdown.Trigger. For example, using an unknown event handler like onPressStart. As well as a react-aria-id mismatch.

I'm using the latest version of @nextui-org/react (1.0.0-beta.10), and wasn't able to find any reference to any *press* related code (on main) in the avatar.tsx component source code. So I'm a bit confused as to where these errors come from exactly.

Related Console Errors:

image image image

Your Example Website or App

https://ndo-so.vercel.app

Affected Code: https://github.com/ndom91/ndo.so/blob/main/src/components/nav.jsx#L46

Steps to Reproduce the Bug or Issue

The console errors do not appear to be thrown in Prod (Vercel URL), so cloning the project and running the dev server (pnpm dev) should reproduce it right away when visiting the index.jsx page.

Expected behavior

Render without console.error().

Screenshots or Videos

See Description Above for console.error screenshots.

Operating System Version

Happening in both MacOS 12.5 + Arch Linux (5.19 Kernel)

Browser

Chrome 101, 102, 104 + Brave 1.38

ndom91 avatar Sep 04 '22 14:09 ndom91

Seems like react-aria useButton params is conflict with stitches styled.button props

Same as #703

sun0day avatar Sep 04 '22 15:09 sun0day

Yeah I saw a 703 got fixed in beta-10. You're saying the same fix needs to be applied to the Avatar Element (or Dropdown.Trigger) as well?

ndom91 avatar Sep 05 '22 08:09 ndom91

  • It hasn't get fixed yet in beta-10
  • Yes, two issues need the same fix

sun0day avatar Sep 05 '22 08:09 sun0day

Ah okay, apparently I misread something - thought it had gotten fixed there already.

Is there a PR or branch or anything open fixing the original NavBar.Link + Dropdown.Trigger? I'm happy to open a PR re-applying those fixes to Avatar

ndom91 avatar Sep 05 '22 12:09 ndom91

Ah okay, apparently I misread something - thought it had gotten fixed there already.

Is there a PR or branch or anything open fixing the original NavBar.Link + Dropdown.Trigger? I'm happy to open a PR re-applying those fixes to Avatar

Currently there are no PRs or branches to fix these problems as I can see.

sun0day avatar Sep 06 '22 03:09 sun0day