8000 [WebProfilerBundle] Update main menu to display active panels first by javiereguiluz · Pull Request #54420 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[WebProfilerBundle] Update main menu to display active panels first #54420

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[WebProfilerBundle] Update main menu to display active panels first
  • Loading branch information
javiereguiluz authored and fabpot committed Mar 28, 2024
commit 05e9192ae2fc933fd36f4729427e7ddeb6d3da3e
Original file li 94E2 ne number Diff line number Diff line change
Expand Up @@ -11,13 +11,32 @@

class SymfonyProfiler {
constructor() {
this.#reorderMainMenuItems();
this.#createTabs();
this.#createTableSearchFields();
this.#createToggles();
this.#createCopyToClipboard();
this.#convertDateTimesToUserTimezone();
}

#reorderMainMenuItems() {
/* reorder the main menu items to always display first the non-disabled items */
const mainMenuElement = document.querySelector('#menu-profiler');
const firstDisabledMenuItem = mainMenuElement.querySelector('li a > span.disabled')?.parentNode?.parentNode;

if (!firstDisabledMenuItem) {
return;
}

const mainMenuItems = mainMenuElement.querySelectorAll('li');
mainMenuItems.forEach(menuItem => {
const isDisabled = null !== menuItem.querySelector('a > span.disabled');
if (!isDisabled) {
mainMenuElement.insertBefore(menuItem, firstDisabledMenuItem);
}
});
}

#createTabs() {
/* the accessibility options of this component have been defined according to: */
/* www.w3.org/WAI/ARIA/apg/example-index/tabs/tabs-manual.html */
Expand Down
0