       let view = context.view(forKey: detailViewKey), // actual view of `detail` view controller
       let rootTableView = root.tableView, // `tableView` of root view controller
       let detailTableView = detail.tableView, // `tableView` of detail view controller
-      let path = root.expandedIndexPath, // `indexPath` of expanded cell
+      let path = root.expandedIndexPath ?? rootTableView.indexPathForSelectedRow, // `indexPath` of expanded or selected cell
       let expandedCell = rootTableView.cellForRow(at: path) as? ElongationCell
     else { return }
     

    let detailViewFinalFrame = context.finalFrame(for: detail) // Final frame for presenting view controller
    
    guard
      let path = root.expandedIndexPath, // get expanded indexPath
      let rootTableView = root.tableView, // get `tableView` from root
      let cell = rootTableView.cellForRow(at: path) as? ElongationCell, // get expanded cell from root `tableView`
      let view = detailView // unwrap optional `detailView`
      else { return }

    // Create `ElongationHeader` from `ElongationCell` and set it as `headerView` to `detail` view controller
    let header = cell.elongationHeader
    detail.headerView = header
    
    // Whole view snapshot
    UIGraphicsBeginImageContextWithOptions(view.bounds.size, false, 0)

      header.contentView.layoutIfNeeded()
      
      view.frame = detailViewFinalFrame
      headerSnapshotView.frame = CGRect(x: 0, y: 0, width: cellFrame.width, height: height)
      tableViewSnapshotView.frame = CGRect(x: 0, y: header.frame.height, width: detailViewFinalFrame.width, height: cellsSize.height)
      tempView.frame = CGRect(x: 0, y: headerSnapshotView.frame.maxY, width: detailViewFinalFrame.width, height: detailViewFinalFrame.height)
    }) { (completed) in
