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

enh(useElementSize): track the size of an element #5582

Closed
wants to merge 1 commit into from

Conversation

max-nextcloud
Copy link
Contributor

@max-nextcloud max-nextcloud commented May 11, 2024

☑️ Resolves

#5561 did not just add the nextTick but also changed the resize handler to

				width.value = widgetRoot.value?.contentRect.width ?? 0

Where widgetRoot is the ref to the root node.
Turns out contentRect is only defined on the entries handed to the resizeObserver.
But widgetRoot is the ref of an HTML Element.

This PR fixes this,
adds tests,
and exposes the functionalilty of observing an elements size
which we are also using in text.

🏁 Checklist

  • ⛑️ Tests are included or are not applicable
  • 📘 Component documentation has been extended, updated or is not applicable
  • 3️⃣ Backport to next requested with a Vue 3 upgrade

@max-nextcloud
Copy link
Contributor Author

/backport to next

1 similar comment
@max-nextcloud
Copy link
Contributor Author

/backport to next

@susnux
Copy link
Contributor

susnux commented May 11, 2024

Why not simply using: https://vueuse.org/core/useElementSize/#useelementsize

@max-nextcloud
Copy link
Contributor Author

Funny... I had looked for something like that but failed to see it. I guess ctrl-f would have helped.

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

Successfully merging this pull request may close these issues.

2 participants