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

Can't useRef to get reference to DOM element #220

Open
ianldgs opened this issue Dec 30, 2020 · 0 comments
Open

Can't useRef to get reference to DOM element #220

ianldgs opened this issue Dec 30, 2020 · 0 comments

Comments

@ianldgs
Copy link

ianldgs commented Dec 30, 2020

Example:

const myRef = useRef(null);
useEffect(() => {
  myRef.current.requestFullscreen();
}, []);
html`<div ref=${myRef}></div>`;

Current behaviour:

Uncaught TypeError: Cannot read property 'requestFullscreen' of undefined

Expected behaviour:

Element enters fullscreen if the browser supports it, some other error otherwise.

Based on this answer I have found a way to make it work. Tested with virtual components! (which seems to be the most difficult part, so normal component should be fine).

Would you accept a PR to address this?

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