سامانه صدور فاکتور و حسابداری

UX: bind desktop scrollbars to shell layers

davoodmehraban89 committed Oct 2, 2026 at 11:55 UTC 510919976e73d32985e900f9c1ac6ac79c9c0923
1 file changed +26 -1
js/ui.js
+26 -1
@@ -1,3 +1,27 @@
1 +function installDesktopScrollOwnershipStyles(){
2 + if(document.getElementById('finora-scroll-ownership-style'))return;
3 + const style=document.createElement('style');
4 + style.id='finora-scroll-ownership-style';
5 + style.textContent=`
6 +@media (min-width:821px){
7 + html,body{height:100%;overflow-y:hidden!important}
8 + .app-root{height:100vh;min-height:0;overflow:hidden}
9 + .module-rail,.module-panel-links,.main-surface{direction:ltr;overscroll-behavior:contain;scrollbar-gutter:stable}
10 + .module-rail>*,.module-panel-links>*,.main-surface>*{direction:rtl}
11 + .main-surface{height:100vh;overflow-y:auto;scrollbar-width:thin}
12 +}
13 +@media (max-width:820px){
14 + .app-root{height:auto;min-height:100vh;overflow-x:hidden}
15 + .main-surface,.shell-panel-collapsed .main-surface{height:auto;overflow-y:visible;direction:rtl}
16 +}
17 +@media print{
18 + html,body,.app-root{height:auto!important;overflow:visible!important}
19 + .main-surface{height:auto!important;overflow:visible!important;direction:rtl!important}
20 +}`;
21 + document.head.appendChild(style);
22 +}
23 +installDesktopScrollOwnershipStyles();
24 +
25 function switchView(viewId){
26 document.querySelectorAll('.view-pane').forEach(el=>el.classList.remove('active'));
27 const target=document.getElementById(viewId);
@@ -9,7 +33,8 @@ function switchView(viewId){
33 if(viewId==='view-accounting-reports'&&window.P6Reports)P6Reports.render();
34 if(typeof syncShellForView==='function')syncShellForView(viewId);
35 if(typeof applyWorkspaceTask==='function')applyWorkspaceTask(viewId,'');
12 - window.scrollTo({top:0,behavior:'smooth'});
36 + const workspace=document.querySelector('.main-surface');
37 + if(window.matchMedia('(min-width:821px)').matches&&workspace)workspace.scrollTo({top:0,behavior:'smooth'});else window.scrollTo({top:0,behavior:'smooth'});
38 }
39 function toggleAccordion(headerEl){headerEl.parentElement.classList.toggle('open');}
40 function refreshAllSurfaces(){