Skip to content

Commit a42a4eb

Browse files
Fix writeToClipboard timeout ordering and add type=button to share button
Agent-Logs-Url: https://github.com/IntelliTect/EssentialCSharp.Web/sessions/feddee6f-34b7-4743-a528-97a454ce5e28 Co-authored-by: BenjaminMichaelis <22186029+BenjaminMichaelis@users.noreply.github.com>
1 parent 3743157 commit a42a4eb

2 files changed

Lines changed: 13 additions & 10 deletions

File tree

EssentialCSharp.Web/src/components/PageNavigation.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const shell = inject("shell");
1717
</span>
1818
</div>
1919
<div v-if="shell.isContentPage" class="turn-page-tooltip">
20-
<button id="share-btn" class="arrow-btn" aria-label="Share this page" @click="shell.shareCurrentPage()">
20+
<button id="share-btn" type="button" class="arrow-btn" aria-label="Share this page" @click="shell.shareCurrentPage()">
2121
<i class="fa-solid fa-share-from-square arrow-icon" />
2222
</button>
2323
<span class="turn-page-tooltip-text tooltip-center">

EssentialCSharp.Web/src/composables/useSiteShell.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -104,22 +104,25 @@ export function useSiteShell() {
104104
() => {
105105
snackbarColor.value = "white";
106106
snackbarMessage.value = successMessage;
107+
if (snackbarTimeoutId !== null) {
108+
clearTimeout(snackbarTimeoutId);
109+
}
110+
snackbarTimeoutId = setTimeout(() => {
111+
snackbarMessage.value = null;
112+
}, 3000);
107113
},
108114
(error) => {
109115
console.error("Could not copy text to clipboard: ", error);
110116
snackbarColor.value = "red";
111117
snackbarMessage.value = `Error: Could not copy text to clipboard: ${error}`;
118+
if (snackbarTimeoutId !== null) {
119+
clearTimeout(snackbarTimeoutId);
120+
}
121+
snackbarTimeoutId = setTimeout(() => {
122+
snackbarMessage.value = null;
123+
}, 3000);
112124
}
113125
);
114-
115-
if (snackbarTimeoutId !== null) {
116-
clearTimeout(snackbarTimeoutId);
117-
snackbarMessage.value = null;
118-
}
119-
120-
snackbarTimeoutId = setTimeout(() => {
121-
snackbarMessage.value = null;
122-
}, 3000);
123126
}
124127

125128
function copyToClipboard(copyText) {

0 commit comments

Comments
 (0)