Skip to content

Commit

Permalink
fix: update page title to match randomized order
Browse files Browse the repository at this point in the history
  • Loading branch information
dustin-jw committed Dec 13, 2023
1 parent 7eda8ae commit d094199
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/js/helpers/update-pagination-links.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ const updateQuestionNumber = (currentQuestionIndex) => {
}
};

const updatePageTitle = (currentQuestionIndex) => {
document.title = document.title.replace(/\d+/, currentQuestionIndex + 1);
};

export const updatePaginationLinks = () => {
const questionsRaw = sessionStorage.getItem('questions');
const currentQuestionIndexRaw = sessionStorage.getItem(
Expand All @@ -66,6 +70,7 @@ export const updatePaginationLinks = () => {
updatePreviousLink(questions, currentQuestionIndex);
updateNextLink(questions, currentQuestionIndex);
updateQuestionNumber(currentQuestionIndex);
updatePageTitle(currentQuestionIndex);

const previousLink = document.querySelector('[data-prev-link]');
previousLink?.addEventListener('click', (event) => {
Expand Down

0 comments on commit d094199

Please sign in to comment.