Skip to content

Commit

Permalink
[WebProfilerBundle] Update main menu to display active panels first
Browse files Browse the repository at this point in the history
  • Loading branch information
javiereguiluz authored and fabpot committed Mar 28, 2024
1 parent 78c6ceb commit 05e9192
Showing 1 changed file with 19 additions and 0 deletions.
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 comments on commit 05e9192

Please sign in to comment.