Просмотр исходного кода

legend: fixes Firefox/baron scroll bug

Compensates for Firefox scrollbar calculation error in the baron framework.
Offsetwidth and clientwidth are used to find the width of the scrollbar. In
the legend these differ by 9px and cause the scroll div to grow by 9px for
every refresh. This fix compensates with a negative margin-right in that
case.

Fixes #11830
Daniel Lee 7 лет назад
Родитель
Сommit
50026fad2e
1 измененных файлов с 4 добавлено и 0 удалено
  1. 4 0
      public/app/plugins/panel/graph/legend.ts

+ 4 - 0
public/app/plugins/panel/graph/legend.ts

@@ -287,6 +287,10 @@ module.directive('graphLegend', function(popoverSrv, $timeout) {
           destroyScrollbar();
           destroyScrollbar();
           legendScrollbar = baron(scrollbarParams);
           legendScrollbar = baron(scrollbarParams);
         }
         }
+
+        // #11830 - compensates for Firefox scrollbar calculation error in the baron framework
+        scroller[0].style.marginRight = '-' + (scroller[0].offsetWidth - scroller[0].clientWidth) + 'px';
+
         legendScrollbar.scroll();
         legendScrollbar.scroll();
       }
       }