Skip to content

Commit 2bfb52a

Browse files
committed
Scroll to top in share modal when notification is visible
1 parent 107d5cf commit 2bfb52a

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

swift_browser_ui_frontend/src/components/ShareModal.vue

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
{{ $t("message.share.close") }}
1717
</c-button>
1818
</header>
19-
<c-card-content>
19+
<c-card-content id="share-card-modal-content">
2020
<h6 class="subtitle is-6 has-text-dark">
2121
{{ $t("message.share.share_subtitle") }}
2222
</h6>
@@ -213,8 +213,7 @@ export default {
213213
this.getSharedDetails();
214214
this.closeSharedNotification();
215215
this.isShared = true;
216-
this.timeout = setTimeout(
217-
() => this.closeSharedNotification(), 3000);
216+
this.closeSharedNotificationWithTimeout();
218217
}
219218
},
220219
);
@@ -298,6 +297,10 @@ export default {
298297
this.isShared = false;
299298
this.isPermissionRemoved = false;
300299
},
300+
closeSharedNotificationWithTimeout() {
301+
document.getElementById("share-card-modal-content").scrollTo(0, 0);
302+
this.timeout = setTimeout(() => this.closeSharedNotification(), 3000);
303+
},
301304
closeSharedNotification: function () {
302305
if (this.timeout !== null) {
303306
clearTimeout(this.timeout);
@@ -319,7 +322,7 @@ export default {
319322
updateSharedFolder: function () {
320323
this.closeSharedNotification();
321324
this.isPermissionUpdated = true;
322-
this.timeout = setTimeout(() => this.closeSharedNotification(), 3000);
325+
this.closeSharedNotificationWithTimeout();
323326
},
324327
removeSharedFolder: function (folderData) {
325328
this.closeSharedNotification();
@@ -328,8 +331,7 @@ export default {
328331
return item.sharedTo !== folderData.projectId.value;
329332
});
330333
this.isPermissionRemoved = true;
331-
332-
this.timeout = setTimeout(() => this.closeSharedNotification(), 3000);
334+
this.closeSharedNotificationWithTimeout();
333335
},
334336
},
335337
};

0 commit comments

Comments
 (0)