Skip to content

fix: Fixing left menu collapsing too quickly#943

Merged
ehsavoie merged 1 commit into
a2aproject:mainfrom
ehsavoie:left_menu_collapse_fix
Jun 19, 2026
Merged

fix: Fixing left menu collapsing too quickly#943
ehsavoie merged 1 commit into
a2aproject:mainfrom
ehsavoie:left_menu_collapse_fix

Conversation

@ehsavoie

Copy link
Copy Markdown
Collaborator

No description provided.

Signed-off-by: Emmanuel Hugonnet <ehugonne@redhat.com>
@ehsavoie ehsavoie merged commit 3430cae into a2aproject:main Jun 19, 2026
1 check passed

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the active link detection logic in head-scripts.html to iterate over all anchor elements within a wrapper list. The reviewer pointed out an improvement opportunity to simplify the logic and reduce overhead by directly using the pathname property of the anchor elements (a.pathname) instead of creating a new URL object for each link.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +37 to +39
var hasActive = Array.from(wrapperUl.querySelectorAll('a')).some(function (a) {
try { return new URL(a.href).pathname === window.location.pathname; } catch (e) { return false; }
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The HTMLAnchorElement (anchor tag <a>) already implements the HTMLHyperlinkElementUtils interface, which provides a standard pathname property. Creating a new URL object for every link is redundant and introduces unnecessary overhead and try-catch complexity. You can directly compare a.pathname with window.location.pathname.

Suggested change
var hasActive = Array.from(wrapperUl.querySelectorAll('a')).some(function (a) {
try { return new URL(a.href).pathname === window.location.pathname; } catch (e) { return false; }
});
var hasActive = Array.from(wrapperUl.querySelectorAll('a')).some(function (a) {
return a.pathname === window.location.pathname;
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant