Skip to content

[@lit-labs/react]: when React ref is passed to a wrapped component attribute l="[Object object] ends up in DOM #2593

Closed

Description

@WickyNilliams

Description

When a React ref is passed a React-wrapper component, then an attribute like l="[Object object] ends up in the DOM.

Steps to Reproduce

  1. Write this code
import { useRef } from "react";
import { MyReactInput } from "./web-component";

export default function App() {
  const ref = useRef();

  return (
      <MyReactInput ref={ref} />
  );
}
  1. See this output...

Live Reproduction Link

Used Codesandbox as its what I am familiar with:

https://codesandbox.io/s/goofy-lederberg-bjiwkb?file=/src/App.tsx:794-857

Expected Results

No unexpected attributes added to DOM.

Actual Results

<my-input l="[Object object]"></my-input>

Browsers Affected

  • Chrome
  • Firefox
  • Safari 14

Didn't test the rest:

  • Edge
  • Safari 11
  • Safari 10
  • IE 11

Activity

  1. changed the title [-]labs/react: when React ref is passed to a wrapped component attribute `l="[Object object]` ends up in DOM[/-] [+][@lit-labs/react]: when React ref is passed to a wrapped component attribute `l="[Object object]` ends up in DOM[/+] on Mar 3, 2022
  2. moved this to 🔥 Front Burner in Lit Project Boardon Mar 3, 2022
  3. moved this from 🔥 Front Burner to ⏱ In Progress in Lit Project Boardon Mar 30, 2022
  4. taylor-vann commented on Apr 4, 2022

    @taylor-vann
    Contributor

    closing this issue, the forwardedRef will no longer be attached to the webcomponent itself

  5. Repository owner moved this from ⏱ In Progress to ✅ Done in Lit Project Boardon Apr 4, 2022
  6. WickyNilliams commented on Apr 11, 2022

    @WickyNilliams
    ContributorAuthor

    Just to confirm, I'm no longer seeing this issue with the latest version. Thanks!

  7. taylor-vann commented on Apr 11, 2022

    @taylor-vann
    Contributor

    Fantastic! Thanks for confirming this for us @WickyNilliams

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions