GCWeb alignment: remove non-exclusive styles to move over#48
Merged
GormFrank merged 1 commit intoServiceCanada:mainfrom Dec 9, 2025
Merged
GCWeb alignment: remove non-exclusive styles to move over#48GormFrank merged 1 commit intoServiceCanada:mainfrom
GormFrank merged 1 commit intoServiceCanada:mainfrom
Conversation
Garneauma
suggested changes
Dec 4, 2025
Contributor
Garneauma
left a comment
There was a problem hiding this comment.
Around line 1334 (inside updatePageState), the previous and next page buttons need to always be there in the HTML. If you are the first page, the previous button's <li> needs the class disabled, same for the next button when you are on the last page.
Basically use the if statement to simply add a class "disabled" if there is no next/previous page. Here's my suggested update to the function:
// Update Pagination section
function updatePagerState( newState ) {
pagerState = newState;
if ( pagerState.maxPage === 0 ) {
pagerElement.textContent = "";
return;
}
else if ( pagerElement.textContent === "" ) {
pagerElement.innerHTML = pagerContainerTemplateHTML;
}
let prevLiNode = document.createElement( "li" ),
nextLiNode = document.createElement( "li" ),
pagerComponentElement = pagerElement.querySelector( "#pager" );
pagerComponentElement.textContent = "";
prevLiNode.innerHTML = previousPageTemplateHTML;
nextLiNode.innerHTML = nextPageTemplateHTML;
if ( !pagerState.hasPreviousPage ) {
prevLiNode.classList.add( "disabled" );
}
if ( !pagerState.hasNextPage ) {
nextLiNode.classList.add( "disabled" );
}
prevLiNode.querySelector( "button" ).onclick = () => {
pagerController.previousPage();
if ( params.isAdvancedSearch ) {
updatePagerUrlParam( pagerState.currentPage );
}
};
nextLiNode.querySelector( "button" ).onclick = () => {
pagerController.nextPage();
if ( params.isAdvancedSearch ) {
updatePagerUrlParam( pagerState.currentPage );
}
};
pagerComponentElement.appendChild( prevLiNode );
pagerState.currentPages.forEach( ( page ) => {
const liNode = document.createElement( "li" );
const pageNo = page;
liNode.innerHTML = pageTemplateHTML.replaceAll( '%[page]', stripHtml( pageNo ) );
if ( pagerState.currentPage - 1 > page || page > pagerState.currentPage + 1 ) {
liNode.classList.add( 'hidden-xs', 'hidden-sm' );
if ( pagerState.currentPage - 2 > page || page > pagerState.currentPage + 2 ) {
liNode.classList.add( 'hidden-md' );
}
}
const buttonNode = liNode.querySelector( 'button' );
if ( page === pagerState.currentPage ) {
liNode.classList.add( "active" );
buttonNode.setAttribute( "aria-current", "page" );
}
buttonNode.onclick = () => {
pagerController.selectPage( pageNo );
if ( params.isAdvancedSearch ) {
updatePagerUrlParam( pagerState.currentPage );
}
};
pagerComponentElement.appendChild( liNode );
} );
pagerComponentElement.appendChild( nextLiNode );
}
Garneauma
approved these changes
Dec 8, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is to align the GC Search UI project with the reference implementation which belongs in GCWeb.
GCWeb will now hold the documentation and visual/semantic reference for the non-exclusive patterns leveraged by the Search UI, such as but not limited to:
Excludes Query Suggestions (QS) for now since no combo box of that nature currently exists in GCWeb.
Note: This is a Patch change, since all current live search pages are hosted on Canada.ca and leverage GCWeb.