Degenerate operators - block diagonal matrix It is known that if we have two operators $\hat{A},\hat{B}$  such that $[A,B]=0$ and they are both not degenerate (each eigenvalues has only one eigenvector) then they can be simultaneously diagonalized with the same basis. What I don't understand is the case that $\hat{A}$ for example is degenerate, I see everywhere that in that case $\hat{B}$ is a block diagonal matrix.
The math indeed shows that in that case, $$\left\langle u_{i}^{m}\left|\hat{B}\right|u_{i}^{n}\right\rangle $$ where the $u_i$ are the eigenvectors with the same eigenvalue, is no longer promised to behave as Kronecker's Delta. Why does it mean it $\hat{B}$ will surely be represented by a block diagonal matrix, having zeros everywhere outside degenerate blocks? I tried to work it out from the math with no successes, since it is far from being trivial for me.
 A: 
If two observables are compatible (i.e. $[A,B]=0$), their corresponding operators
possess a set of common (or simultaneous) eigenstates (this theorem
holds for both degenerate and nondegenerate eigenstates). (This is theorem 3.1 from N. Zettili.)

If both are nondegenerate we can go further and say that all possible sets of eigen states of one operator also are eigen states for the other.
But in the degenerate case (lets say A is degenerate but not B) we possibly can also find a set of eigenstates of A which may not be eigen states of B. One way to construct these is we can first find the eigen states of B and then all of them will be eigen states of A. Now we can take those eigen states for which eigen value for A is same and form their linear combinations. Now we can replace the old eigenstates of B with the linear combinations. Now this new set of states are eigen states of A but not B.
Even if two operators are not compatible (i.e. $[A,B]\neq 0$) it still is possible to have an common eigen state because $[A,B]\psi =0$ might still hold true for some $\psi$. To say that two operators do not have common eigen states we need a stronger condition that $[A,B]\psi \neq 0$ $\forall \psi$.
Edit: In the case where $[A,B]=0$ and both are degenerate, if both observables are degenerate at the exact same eigen values and the number of independent states which that eigen value is also same(i.e. dimensionality of degeneracy), then also we can say that nd say that all possible sets of eigen states of one operator also are eigen states for the other. If they are degenerate at different eigen values then it is possible to have a set of eigenstates of A which may not be eigen states of B.
A: This is a complement to this answer.
In the case where both $A$ and $B$ are degenerate, we can still find a common eigenbasis. To do this, we use the spectral theorem to diagonalize $A$ in an orthonormal basis $\{ |a,n \rangle\}$ (with $a$ the eigenvalue and $n$ to index the degenerate eigenvectors). The eigenspace $E_a$ of $A$ is the vector space spanned by the $|a,n\rangle$ for all possible $n$. It is the space of all eigenvectors of $A$ with eigenvalue $a$.
If we take an arbitrary $|\psi \rangle \in E_a$, we see that $AB|\psi\rangle = B A|\psi\rangle  = a B|\psi\rangle$, so that $B|\psi\rangle \in E_a$.
We can therefore apply the spectral theorem to $B$ on the space $E_a$, to find a orthonormal basis of eigenvectors of $B$. Since all vectors in $E_a$ are already eigenvectors of $A$, the new ones are common eigenvectors.
Now we put together all the vectors we obtained for the different values of $a$, and we get a basis for the whole Hilbert space, composed of eigenvectors of both $A$ and $B$.
