Skip to content

Commit

Permalink
more ui fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
rohanharikr committed Dec 4, 2024
1 parent 29fb9f2 commit 3756dd3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@
await initShiki(); // syntax highlighting
mounted = true;
// focus authz response section for better mobile UX
// runs after 'mounted' to ensure UI is rendered
if (claims) focusAuthzResponseSection();
});
function saveStateToLocalStorage() {
Expand Down Expand Up @@ -230,8 +234,6 @@
} catch (err) {
console.error(err);
showErrorNotification = true;
} finally {
focusAuthzResponseSection();
}
}
Expand All @@ -254,8 +256,6 @@
} catch (err) {
console.error(err);
showErrorNotification = true;
} finally {
focusAuthzResponseSection();
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/lib/utils.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { tick } from 'svelte';
import { createAuthRequest } from '@hellocoop/helper-browser';

function cleanUrl() {
Expand Down Expand Up @@ -78,7 +79,8 @@ async function sendPlausibleEvent() {
}
}

function focusAuthzResponseSection() {
async function focusAuthzResponseSection() {
await tick(); // ensures UI updates are complete
const ele = document.querySelector('#authz-response-container');
if (ele) ele.scrollIntoView();
}
Expand Down

0 comments on commit 3756dd3

Please sign in to comment.