-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Currently, most tooltips are shown above buttons and text. When these tooltips appear at the top of the viewport, part of the tooltips will not be rendered. Let's implement changes such that these tooltips appear below the text or button, when appearing at the top of the viewport.
- Loading branch information
1 parent
056fa5f
commit 54596ed
Showing
4 changed files
with
127 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { defineComponent } from 'vue'; | ||
|
||
export default defineComponent({ | ||
methods: { | ||
onTooltipHover(refName: string): void { | ||
const tooltipTextElement = (this.$refs[refName] as HTMLElement[])[0]; | ||
if (this.isElementAboveViewport(tooltipTextElement)) { | ||
tooltipTextElement.classList.add('bottom-aligned'); | ||
} | ||
}, | ||
resetTooltip(refName: string): void { | ||
const tooltipTextElement = (this.$refs[refName] as HTMLElement[])[0]; | ||
tooltipTextElement.classList.remove('bottom-aligned'); | ||
}, | ||
isElementAboveViewport(el: Element): boolean { | ||
return el.getBoundingClientRect().top <= 0; | ||
}, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters