How to use the @react-md/wia-aria.useScrollLock function in @react-md/wia-aria

To help you get started, we’ve selected a few @react-md/wia-aria examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mlaursen / react-md / packages / examples / src / SheetDemo.tsx View on Github external
const handleKeyDown = (position: SheetPosition) => (
    event: React.KeyboardEvent
  ) => {
    const { key } = event;
    if (key === "ArrowUp") {
      event.preventDefault();
      show(position, false)(event);
    } else if (key === "ArrowDown") {
      event.preventDefault();
      show(position)(event);
    }
  };

  const hide = () => setVisible(false);
  const toggle = () => setVisible(prevVisible => !prevVisible);
  useScrollLock(visible);

  // const { containerProps, setActiveId } = useActiveDescendantState({
  //   // search: true,
  //   defaultActiveId: "",
  //   // incrementKeys: ["ArrowDown"],
  //   // decrementKeys: ["ArrowUp"],
  //   // jumpToFirstKeys: ["Home"],
  //   // jumpToLastKeys: ["End"],
  //   onKeyDown: event => {
  //     if (event.key === "Tab" || event.key === "Escape") {
  //       event.stopPropagation();
  //       hide();
  //     }
  //   },
  // });

@react-md/wia-aria

A package for determining which element on the page is the current keyboard focus/selection.

MIT
Latest version published 6 years ago

Package Health Score

56 / 100
Full package analysis