Let's denote the number of books Tanner shelved as \( T \) and the number of books Keith shelved as \( K \). According to the problem, Tanner shelves 4 books at a time, and Keith shelves 8 books at a time. Thus, we can express the number of books shelved by each as follows:
\[ T = 4m \quad \text{for some integer } m \] \[ K = 8n \quad \text{for some integer } n \]
We need to find the smallest number of books \( T \) and \( K \) such that \( T = K \). This leads to the equation:
\[ 4m = 8n \]
We can simplify this equation by dividing both sides by 4:
\[ m = 2n \]
From this equation, we can see that \( m \) must be an even integer (since it equals 2 times some integer \( n \)). Therefore, we can express \( m \) in terms of \( n \):
\[ m = 2n \]
Substituting \( m \) back into the equation for \( T \):
\[ T = 4m = 4(2n) = 8n \] \[ K = 8n \]
From this relationship, we conclude that both \( T \) and \( K \) are equal to \( 8n \). To find the smallest number of books shelved by both Tanner and Keith, we take \( n = 1 \):
\[ T = K = 8 \cdot 1 = 8 \]
Thus, the smallest number of books that both Tanner and Keith could have shelved, such that they shelve the same number of books, is
\[ \boxed{8}. \]