-
Notifications
You must be signed in to change notification settings - Fork 1.4k
added parent null checks to tooltip components #8201
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
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -40,6 +40,9 @@ export default { | |||||
| inject: ['toolTipText', 'toolTipLocation', 'parentElement', 'cssClasses'], | ||||||
| computed: { | ||||||
| toolTipCoordinates() { | ||||||
| if (!this.parentElement || !document.contains(this.parentElement)) { | ||||||
|
||||||
| if (!this.parentElement || !document.contains(this.parentElement)) { | |
| if (!this.parentElement || !document.body.contains(this.parentElement)) { |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -53,6 +53,10 @@ const tooltipHelpers = { | |||||
| return; | ||||||
| } | ||||||
| let parentElement = this.$refs[elementRef]; | ||||||
| if (!parentElement || !document.contains(parentElement)) { | ||||||
|
||||||
| if (!parentElement || !document.contains(parentElement)) { | |
| if (!parentElement || !document.body.contains(parentElement)) { |
Outdated
Copilot
AI
Nov 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new null check logic added to handle missing parent elements should be covered by tests. Consider adding test cases that verify the behavior when:
parentElementis nullparentElementis not in the document- The tooltip is created successfully with a valid parent element
This would help ensure the null checks work as expected and prevent regressions. Other API modules in the codebase have corresponding Spec files (e.g., EditorSpec.js).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variable
this.tooltipis undefined in the Tooltip class. The code attempts to accessthis.tooltip.parentElement, butthis.tooltipis never initialized in the constructor.The
parentElementis passed to the constructor but only provided to the Vue component, not stored as an instance variable. To fix this, you should either:parentElementasthis.parentElementin the constructor and checkthis.parentElementdirectly, orthis.tooltipin the constructorSuggested fix: