function getFirstLeaf(node: any): Node {
  while (
    node.firstChild &&
    // data-blocks has no offset
    ((isElement(node.firstChild) &&
      (node.firstChild: Element).getAttribute('data-blocks') === 'true') ||
      getSelectionOffsetKeyForNode(node.firstChild))
  ) {
    node = node.firstChild;
  }
  return node;
}
Identify the first leaf descendant for the given node.