Skip to content

Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.

625 B
Raw Blame
import { useEffect } from 'react';

// Chakra tooltips sometimes open during a drag operation. We can fix it by dispatching an event that chakra listens
// for to close tooltips. It's reaching into the internals but it seems to work.

const closeEventName = 'chakra-ui:close-tooltip';

export const useCloseChakraTooltipsOnDragFix = () => {
  useEffect(() => {
    const closeTooltips = () => {
      document.dispatchEvent(new window.CustomEvent(closeEventName));
    };
    document.addEventListener('drag', closeTooltips);

    return () => {
      document.removeEventListener('drag', closeTooltips);
    };
  }, []);
};