]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-16537 Fixing tab scroll issue when changing tabs
authorRevanshu Paliwal <revanshu.paliwal@sonarsource.com>
Thu, 11 Aug 2022 16:16:15 +0000 (18:16 +0200)
committersonartech <sonartech@sonarsource.com>
Thu, 11 Aug 2022 20:03:49 +0000 (20:03 +0000)
server/sonar-web/src/main/js/components/rules/TabViewer.tsx

index c54cea3752302f3c3c369d6b63f57d7ef2f77133..f03307c16ed48f5095f0a054f684e88c21e2c073 100644 (file)
@@ -313,7 +313,10 @@ export class TabViewer extends React.PureComponent<TabViewerProps, State> {
                 maxHeight: scrollInTab ? `calc(100vh - ${top + 100}px)` : 'initial'
               }}
               className="bordered display-flex-column">
-              <div className="overflow-y-auto spacer">{tabContent}</div>
+              {/* Adding a key to force re-rendering of the tab container, so that it resets the scroll position */}
+              <div className="overflow-y-auto spacer" key={selectedTab.key}>
+                {tabContent}
+              </div>
             </div>
           )}
         </ScreenPositionHelper>