[ 
https://issues.apache.org/jira/browse/BEAM-13229?focusedWorklogId=772893&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-772893
 ]

ASF GitHub Bot logged work on BEAM-13229:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 20/May/22 15:59
            Start Date: 20/May/22 15:59
    Worklog Time Spent: 10m 
      Work Description: nausharipov commented on code in PR #17638:
URL: https://github.com/apache/beam/pull/17638#discussion_r878304527


##########
website/www/site/assets/js/language-switch-v2.js:
##########
@@ -10,11 +10,26 @@
 // License for the specific language governing permissions and limitations 
under
 // the License.
 
+function getElPreviousPositionAndData(el) {
+    const clickedLangSwitchEl = el.target.closest(".language-switcher");
+    const elPreviousOffsetFromViewPort = 
clickedLangSwitchEl.getBoundingClientRect().top;
+    return {
+        elPreviousOffsetFromViewPort,
+        clickedLangSwitchEl,
+    }
+}
+
+function setScrollToNewPosition(clickedElData) {
+    const { elPreviousOffsetFromViewPort, clickedLangSwitchEl } = 
clickedElData;
+    const elCurrentHeight = window.pageYOffset + 
clickedLangSwitchEl.getBoundingClientRect().top;
+    $('html, body').scrollTop(elCurrentHeight - elPreviousOffsetFromViewPort);
+}
+
 $(document).ready(function() {
     function Switcher(conf) {
         var id = conf["class-prefix"],
-            def = conf["default"],
-            langs = [];
+          def = conf["default"],

Review Comment:
   please, format the file



##########
website/www/site/assets/js/language-switch-v2.js:
##########
@@ -10,11 +10,26 @@
 // License for the specific language governing permissions and limitations 
under
 // the License.
 
+function getElPreviousPositionAndData(el) {
+    const clickedLangSwitchEl = el.target.closest(".language-switcher");
+    const elPreviousOffsetFromViewPort = 
clickedLangSwitchEl.getBoundingClientRect().top;
+    return {
+        elPreviousOffsetFromViewPort,
+        clickedLangSwitchEl,
+    }
+}
+
+function setScrollToNewPosition(clickedElData) {
+    const { elPreviousOffsetFromViewPort, clickedLangSwitchEl } = 
clickedElData;
+    const elCurrentHeight = window.pageYOffset + 
clickedLangSwitchEl.getBoundingClientRect().top;
+    $('html, body').scrollTop(elCurrentHeight - elPreviousOffsetFromViewPort);
+}
+
 $(document).ready(function() {
     function Switcher(conf) {
         var id = conf["class-prefix"],
-            def = conf["default"],
-            langs = [];
+          def = conf["default"],

Review Comment:
   please, format files





Issue Time Tracking
-------------------

    Worklog Id:     (was: 772893)
    Time Spent: 4.5h  (was: 4h 20m)

> [Website] Bug in side navigation when changing tabs in code snippets
> --------------------------------------------------------------------
>
>                 Key: BEAM-13229
>                 URL: https://issues.apache.org/jira/browse/BEAM-13229
>             Project: Beam
>          Issue Type: Bug
>          Components: website
>            Reporter: Mike Hernandez
>            Assignee: Bulat Safiullin
>            Priority: P2
>              Labels: bug, website
>          Time Spent: 4.5h
>  Remaining Estimate: 0h
>
> Steps to reproduce the bug:
>  # Go to the [Beam Programming 
> Guide|https://beam.apache.org/documentation/programming-guide/] page
>  # Go to any code snippet and click on its tabs
>  # Notice at the right side in the side nav that the current pointer will be 
> jumping around sections
> Other pages of Beam's documentation might have the same issue.



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to