Thanks to visit codestin.com
Credit goes to github.com

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
Original file line 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