gramene-search 2.15.2 → 2.15.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -20651,14 +20651,31 @@ const $693dd8c7a5607c3a$var$ResultsCmp = (props)=>{
20651
20651
  const divRef = (0, $gXNCa$react.useRef)(null);
20652
20652
  (0, $gXNCa$react.useEffect)(()=>{
20653
20653
  if (v.shouldScroll) {
20654
- // scrollIntoView scrolls whichever ancestor is scrollable — the
20655
- // window on most layouts, or the results pane when the sidebar and
20656
- // results scroll independently (e.g. the sorghumbase app shell).
20657
- // window.scrollTo would be a no-op in that pane-scroll case.
20658
- if (divRef.current) divRef.current.scrollIntoView({
20659
- behavior: 'smooth',
20660
- block: 'start'
20661
- });
20654
+ const el = divRef.current;
20655
+ if (el) {
20656
+ // Scroll ONLY the results' own scroll container to this view. The
20657
+ // sidebar and results scroll independently in the sorghumbase app
20658
+ // shell, and el.scrollIntoView can walk every scrollable ancestor
20659
+ // (nudging the sidebar too), so instead find the results pane and
20660
+ // scroll just that. Fall back to the window when the results
20661
+ // aren't in a dedicated scroll pane (other layouts / mobile).
20662
+ let pane = el.parentElement;
20663
+ while(pane){
20664
+ const oy = window.getComputedStyle(pane).overflowY;
20665
+ if ((oy === 'auto' || oy === 'scroll') && pane.scrollHeight > pane.clientHeight) break;
20666
+ pane = pane.parentElement;
20667
+ }
20668
+ if (pane) {
20669
+ const top = el.getBoundingClientRect().top - pane.getBoundingClientRect().top + pane.scrollTop;
20670
+ pane.scrollTo({
20671
+ top: top,
20672
+ behavior: 'smooth'
20673
+ });
20674
+ } else window.scrollTo({
20675
+ top: el.getBoundingClientRect().top + window.scrollY,
20676
+ behavior: 'smooth'
20677
+ });
20678
+ }
20662
20679
  props.doCancelShouldScroll();
20663
20680
  }
20664
20681
  }, [