File size: 592 Bytes
2eae9f0
c1fc133
 
 
 
2eae9f0
 
 
 
 
 
 
 
c1fc133
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import { createElement, forwardRef, type HTMLAttributes } from "react";

type ScrollElement = "div" | "aside" | "nav";
type OverlayScrollProps = HTMLAttributes<HTMLElement> & { element?: ScrollElement };

// Keep the name so the three mounts stay put; R11 retired the overlay in favour of native scrolling.
export const OverlayScroll = forwardRef<HTMLElement, OverlayScrollProps>(function OverlayScroll(
  { element = "div", className, children, ...props }, ref,
) {
  return createElement(
    element,
    { ...props, className, ref, tabIndex: props.tabIndex ?? 0 },
    children,
  );
});