Skip to content

Commit 88d7e97

Browse files
committed
Click button again to cancel the overlay
Signed-off-by: Jay Wang <[email protected]>
1 parent 774ed3b commit 88d7e97

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/components/recommender-view/recommender-view.ts

+13-2
Original file line numberDiff line numberDiff line change
@@ -793,13 +793,19 @@ export class RecRecRecommenderView extends LitElement {
793793
e.stopPropagation();
794794
e.preventDefault();
795795

796-
this.citeTimeBlurred();
797-
798796
if (!this.paperOverlayElement) {
799797
console.error('paperOverlayElement are not initialized yet.');
800798
return;
801799
}
802800

801+
const overlayName = `${type}-${recommender.authorID}`;
802+
if (this.paperOverlayElement.getAttribute('data-name') === overlayName) {
803+
this.citeTimeBlurred();
804+
return;
805+
}
806+
807+
this.citeTimeBlurred();
808+
803809
// Hide the description tooltip
804810
this.citeTimeButtonMouseLeft(e);
805811

@@ -843,6 +849,10 @@ export class RecRecRecommenderView extends LitElement {
843849

844850
this.curClickedCiteTimeAuthorID = recommender.authorID;
845851
this.paperOverlayElement.classList.remove('hidden');
852+
this.paperOverlayElement.setAttribute(
853+
'data-name',
854+
`${type}-${recommender.authorID}`
855+
);
846856
}
847857

848858
citeTimeButtonMouseEntered(
@@ -903,6 +913,7 @@ export class RecRecRecommenderView extends LitElement {
903913
}
904914

905915
this.paperOverlayElement.classList.add('hidden');
916+
this.paperOverlayElement.removeAttribute('data-name');
906917
this.curClickedCiteTimeAuthorID = null;
907918
this.overlayCleanup();
908919
this.overlayCleanup = () => {};

0 commit comments

Comments
 (0)