Strictly speaking, you would do this coloring with all connected components of the intersection of your rectangle and M. (And the rectangle could be any region.)
The example messes this up, although it is a correct example, the square on the diagram showing the local piece containing non-connected parts is wrong. The comb has more and more teeth, infinitely many in a bounded space, on the left side. Only a rectangle which includes the left edge properly shows why the set isn't locally connected. The rectangle pictured includes finitely many teeth which have a separation between them. A rectangle overlapping the left edge of the comb would include separate components which get arbitrarily close to that left edge and so can't be separated by a border.