fix(sidebar): centrar labels (styles.css tenía mayor especificidad), preservar scroll al toggle
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
3a66576ff8
commit
18051a4f31
@@ -159,7 +159,7 @@ if (class_exists('ModuleRegistry', false)) {
|
||||
?>
|
||||
<li class="sidebar-section<?= $_catHasActive ? ' has-active' : '' ?>"
|
||||
data-cat="<?= $catId ?>"
|
||||
onclick="sbToggleCat('<?= $catId ?>', this)">
|
||||
onclick="sbToggleCat('<?= $catId ?>',this,event)">
|
||||
<span class="sb-cat-label">
|
||||
<i class="<?= htmlspecialchars($catData['icon'], ENT_QUOTES, 'UTF-8') ?> me-1"></i>
|
||||
<?= htmlspecialchars($catData['label'], ENT_QUOTES, 'UTF-8') ?>
|
||||
@@ -380,7 +380,11 @@ if (class_exists('ModuleRegistry', false)) {
|
||||
}
|
||||
}
|
||||
|
||||
window.sbToggleCat = function(catId, sectionEl) {
|
||||
window.sbToggleCat = function(catId, sectionEl, ev) {
|
||||
if (ev) { ev.preventDefault(); ev.stopPropagation(); }
|
||||
var nav = document.getElementById('erp-sidebar');
|
||||
var savedScroll = nav ? nav.scrollTop : 0;
|
||||
|
||||
var group = document.getElementById(catId);
|
||||
if (!group) return;
|
||||
var isCollapsed = group.classList.contains('collapsed');
|
||||
@@ -400,6 +404,9 @@ if (class_exists('ModuleRegistry', false)) {
|
||||
});
|
||||
}
|
||||
setCollapsed(arr);
|
||||
|
||||
// Restaurar scroll del sidebar para que no salte al top
|
||||
if (nav) { requestAnimationFrame(function(){ nav.scrollTop = savedScroll; }); }
|
||||
};
|
||||
|
||||
// ── Buscador de menú ─────────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user