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

editableRef prop in Plate component doesn't actually attach ref #1903

Closed
albertpurnama opened this issue Sep 29, 2022 · 3 comments
Closed

editableRef prop in Plate component doesn't actually attach ref #1903

albertpurnama opened this issue Sep 29, 2022 · 3 comments
Labels
bug Something isn't working slate

Comments

@albertpurnama
Copy link
Contributor

albertpurnama commented Sep 29, 2022

Description
editableRef prop doesn't work according to spec. It produces an error and doesn't attach the ref to the Editable's DOM element.

Screenshot from 2022-09-28 17-13-02

Steps

  1. Create reference using either the hook useRef or React.createRef
  2. Pass that reference through editableRef
  3. It should show an error in the console and the ref actually never got linked/attached to the DOM element

or go to the sandbox and you should see the error immediately in the console

Sandbox

https://codesandbox.io/s/sandpack-project-forked-oqs6r8?file=/App.tsx

Expectation

The newly created ref should be attached to the editableRef

Environment

  • slate: 0.78.0
  • slate-react: 0.79.0
  • browser: chrome
@albertpurnama albertpurnama added the bug Something isn't working label Sep 29, 2022
@zbeyens
Copy link
Member

zbeyens commented Sep 29, 2022

Indeed, it has not effect until slate fixes it ianstormtaylor/slate#4082

@zbeyens zbeyens added the slate label Sep 29, 2022
@albertpurnama
Copy link
Contributor Author

albertpurnama commented Sep 29, 2022

I see that now, should I close this?

Also what do you think is the best way to get reference to the Editable component as a workaround to this issue?

@zbeyens
Copy link
Member

zbeyens commented Sep 29, 2022

Yes let's close it.

Not sure if there is a way to access a DOM node without ref in React (did a quick lookup to no avail).

@zbeyens zbeyens closed this as completed Sep 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working slate
Projects
None yet
Development

No branches or pull requests

2 participants