teableio/teable

View on GitHub
packages/sdk/src/components/grid/utils/element.ts

Summary

Maintainability
A
0 mins
Test Coverage
export const isAncestorOfActiveElement = (id: string): boolean => {
  let activeElement = document.activeElement;

  while (activeElement) {
    if (activeElement.id === id) {
      return true;
    }
    activeElement = activeElement.parentElement;
  }

  return false;
};