Skip to content

Commit

Permalink
Fix logout button not working with tab
Browse files Browse the repository at this point in the history
  • Loading branch information
dosisod committed Nov 24, 2023
1 parent 6632091 commit 2a52dcb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
11 changes: 0 additions & 11 deletions frontend/static/common.css
Original file line number Diff line number Diff line change
Expand Up @@ -85,17 +85,6 @@ a[disabled] {
border-radius: var(--border-radius);
}

#logout {
cursor: pointer;
padding: 0.4em !important;
height: min-content;
transition: background 150ms;
}

#logout:hover {
background: var(--medium-gray);
}

.ci-status[data-status="success"] {
color: var(--green);
background: var(--dark-green) !important;
Expand Down
12 changes: 10 additions & 2 deletions frontend/static/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ function refreshTokenLoop() {
setInterval(refreshToken, 60_000);
}

const logout = () => {
const logout = (e) => {
if (e.type === "keydown" && e.key !== "Enter") return;

if (confirm("Are you sure you want to log out?")) {
removeKey("jwt");
window.location.href = "/login";
Expand Down Expand Up @@ -179,7 +181,13 @@ class Navbar extends HTMLElement {
<a href="/dashboard" id="back" part="back">&#8592; Back</a>
<slot></slot>
<span id="version" part="version">${version}</span>
<img id="logout" src="/static/img/logout.svg" onclick="logout()" />
<img
id="logout"
src="/static/img/logout.svg"
onclick="logout(event)"
onkeydown="logout(event)"
tabindex=0
/>
</div>
<style>
Expand Down

0 comments on commit 2a52dcb

Please sign in to comment.