Skip to content
Discussion options

You must be logged in to vote

I have zero experience with HTMX but this error leads me to believe you're calling focus() before the custom element has upgraded.

htmx.js:1845 TypeError: Cannot read properties of null (reading 'focus')
at HTMLElement.focus (chunk.YUYATEN7.js:70:17)

If you defer your logic, I bet you won't get that error anymore, e.g.

await customElements.whenDefined('sl-button');

// apply focus here

Replies: 6 comments 16 replies

Comment options

You must be logged in to vote
1 reply
@benopotamus
Comment options

Answer selected by benopotamus
Comment options

You must be logged in to vote
1 reply
@benopotamus
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
8 replies
@benopotamus
Comment options

@claviska
Comment options

@benopotamus
Comment options

@KonnorRogers
Comment options

@claviska
Comment options

Comment options

You must be logged in to vote
6 replies
@HanY2B
Comment options

@KonnorRogers
Comment options

@HanY2B
Comment options

@MichaelWest22
Comment options

@MichaelWest22
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
6 participants