code: function checkPanelPosition() {
          const currentPanelRect = panel.getBoundingClientRect();
  
          if (currentPanelRect.top + currentPanelRect.height > getScrollContainerHeight() &&
            !isDocked) {
            dock();
          } else if (
            isDocked &&
            currentPanelRect.top + currentPanelRect.height +
              getScrollContainerScrollTop() >= getInitialUndockedPosition() + TOGGLE_GAP
          ) {
            undock();
          }
        }
docs: Check panel position