Skip to content

Commit

Permalink
[#1928] Fix tooltip zIndex such that it doesn't occlude next file tit…
Browse files Browse the repository at this point in the history
…le (#2057)

Currently, if one hovers over a tooltip of the pinned title of
a file whose content is scrolled almost completely, such that 
the title of the next file is just below the pinned title, the 
tooltip is not displayed appropriately, as the title of the next 
file obstructs it.

Let's fix this issue.
  • Loading branch information
pratham31012002 committed Nov 8, 2023
1 parent 54596ed commit f29dc16
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 13 deletions.
6 changes: 3 additions & 3 deletions frontend/cypress/tests/chartView/chartView_zoomFeature.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ describe('range changes in chartview should reflect in zoom', () => {
.get('#summary-charts .summary-chart__ramp .ramp')
.first()
.click(120, 20)
.click(185, 20);
.click(170, 20);

cy.get('#tab-zoom')
.should('be.visible');
Expand All @@ -306,7 +306,7 @@ describe('range changes in chartview should reflect in zoom', () => {
cy.get('body').type(zoomKey, { release: false })
.get('#summary-charts .summary-chart__ramp .ramp')
.first()
.click(185, 20)
.click(170, 20)
.click(250, 20);

cy.get('#tab-zoom')
Expand All @@ -333,7 +333,7 @@ describe('range changes in chartview should reflect in zoom', () => {
cy.get('body').type(zoomKey, { release: false })
.get('#summary-charts .summary-chart__ramp .ramp')
.first()
.click(185, 20)
.click(170, 20)
.click(225, 20);

cy.get('#tab-zoom')
Expand Down
1 change: 1 addition & 0 deletions frontend/src/styles/_z-indices.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ $z-indices: (
'header': 100,
'loader': 10,
'tooltip': 100,
'max-value': 250,
);
1 change: 0 additions & 1 deletion frontend/src/styles/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ a.broken-link {
}

&.bottom-aligned {
@include medium-font;
bottom: auto;
top: 125%;
}
Expand Down
37 changes: 28 additions & 9 deletions frontend/src/views/c-authorship.vue
Original file line number Diff line number Diff line change
Expand Up @@ -101,19 +101,22 @@
.empty(v-if="info.files.length === 0") nothing to see here :(
template(v-for="(file, i) in selectedFiles", v-bind:key="file.path")
.file(v-bind:ref="file.path")
.title(v-bind:class="{'sticky':\ file.active}")
.title(
v-bind:class="{'sticky':\ file.active}",
v-bind:ref="`${file.path}-title`"
)
span.caret(v-on:click="toggleFileActiveProperty(file)")
.tooltip(
v-show="file.active",
v-on:mouseover="onTooltipHover(`${file.path}-hide-file-tooltip`)",
v-on:mouseout="resetTooltip(`${file.path}-hide-file-tooltip`)"
v-on:mouseover="onTitleTooltipHover(`${file.path}-hide-file-tooltip`, `${file.path}-title`)",
v-on:mouseout="resetTitleTooltip(`${file.path}-hide-file-tooltip`, `${file.path}-title`)"
)
font-awesome-icon(icon="caret-down", fixed-width)
span.tooltip-text(v-bind:ref="`${file.path}-hide-file-tooltip`") Click to hide file details
.tooltip(
v-show="!file.active",
v-on:mouseover="onTooltipHover(`${file.path}-show-file-tooltip`)",
v-on:mouseout="resetTooltip(`${file.path}-show-file-tooltip`)"
v-on:mouseover="onTitleTooltipHover(`${file.path}-show-file-tooltip`, `${file.path}-title`)",
v-on:mouseout="resetTitleTooltip(`${file.path}-show-file-tooltip`, `${file.path}-title`)"
)
font-awesome-icon(icon="caret-right", fixed-width)
span.tooltip-text(v-bind:ref="`${file.path}-show-file-tooltip`") Click to show file details
Expand Down Expand Up @@ -149,8 +152,8 @@
v-bind:href="getHistoryLink(file)", target="_blank"
)
.tooltip(
v-on:mouseover="onTooltipHover(`${file.path}-view-history-tooltip`)",
v-on:mouseout="resetTooltip(`${file.path}-view-history-tooltip`)"
v-on:mouseover="onTitleTooltipHover(`${file.path}-view-history-tooltip`, `${file.path}-title`)",
v-on:mouseout="resetTitleTooltip(`${file.path}-view-history-tooltip`, `${file.path}-title`)"
)
font-awesome-icon.button(icon="history")
span.tooltip-text(
Expand All @@ -163,8 +166,8 @@
title="click to view the blame view of file"
)
.tooltip(
v-on:mouseover="onTooltipHover(`${file.path}-view-blame-tooltip`)",
v-on:mouseout="resetTooltip(`${file.path}-view-blame-tooltip`)"
v-on:mouseover="onTitleTooltipHover(`${file.path}-view-blame-tooltip`, `${file.path}-title`)",
v-on:mouseout="resetTitleTooltip(`${file.path}-view-blame-tooltip`, `${file.path}-title`)"
)
font-awesome-icon.button(icon="user-edit")
span.tooltip-text(
Expand Down Expand Up @@ -499,6 +502,18 @@ export default defineComponent({
}
},
onTitleTooltipHover(tooltipTextElement: string, titleTextElement: string): void {
this.onTooltipHover(tooltipTextElement);
const titleElement = (this.$refs[titleTextElement] as HTMLElement[])[0];
titleElement.classList.add('max-zIndex');
},
resetTitleTooltip(tooltipTextElement: string, titleTextElement: string): void {
this.resetTooltip(tooltipTextElement);
const titleElement = (this.$refs[titleTextElement] as HTMLElement[])[0];
titleElement.classList.remove('max-zIndex');
},
isUnknownAuthor(name: string): boolean {
return name === '-';
},
Expand Down Expand Up @@ -882,6 +897,10 @@ export default defineComponent({
position: sticky;
}
&.max-zIndex {
z-index: z-index('max-value');
}
.caret {
cursor: pointer;
order: -2;
Expand Down

0 comments on commit f29dc16

Please sign in to comment.