In questions regarding subsets of $X \times Y$ in the product topology, is it correct to reason in a "component-wise" way? The problem
Let $A$ and $B$ be compact subspaces of $X$ and $Y$ and $W$ an
open set in $X \times Y$ containing $A \times B$. Show that there are open sets $U \supseteq A$ and $V \supseteq B$ such that 
$$A \times B \subseteq U \times V \subseteq W.$$
My attempt at a solution
Let $W = C \times D$ where $C$ and $D$ are open, $C \supseteq A, D \supseteq B$.
Let $\mathcal{A}$ be an open cover of $A$. Since $A$ is compact, there is a finite subcollection $\{ U_k \}_{k=1}^n$ of $\mathcal{A}$ still covering $A$.
Now, let $U = C \cap (U_1 \cup \dots \cup U_n)$, then $U \subseteq C$, $U$ open and $A \subseteq U$.
Likewise we can find a $V$ s.t. $V \subseteq D$, $V$ open and $B \subseteq V$.
Then we have 
$$A \times B \subseteq U \times V \subseteq C \times D = W,$$
as desired. 
My question
Can I argue in this "component-wise" way? That is, can I look at $A$ and $B$ separately, or do I have to look at $A \times B$ as "one element", so to speak?
 A: No, you can’t argue in this fashion. You can’t assume that $W$ is a product of two open sets; it might be much more complicated. For example, you might have $X=Y=\Bbb R$, $A=B=[-1,1]$, and $W$ an open disk of radius greater than $\sqrt2$ centred at the origin. 
However, we can use the fact that for each $a\in A$, $\{a\}\times B$ is homeomorphic to $B$ (and therefore compact) to argue as follows. Fix $a\in A$. For each $b\in B$ there are open sets $U(a,b)$ in $X$ and $V(a,b)$ in $Y$ such that $\langle a,b\rangle\in U(a,b)\times V(a,b)\subseteq W$. Then $\{V(a,b):b\in B\}$ is an open cover of $B$ in $Y$, so it has a finite subcover $\{V(a,b_1),\dots,V(a,b_{n(a)})\}$. Then 
$$\{U(a,b_k)\times V(a,b_k):k=1,\dots,n(a)\}$$
is an open cover of $\{a\}\times B$. Let $U_a=\bigcap_{k=1}^{n(a)}U(a,b_k)$ and $V_a=\bigcup_{k=1}^{n(a)}V(a,b_k)$; then $U_a\times V_a$ is open in $X\times Y$, and $\{a\}\times B\subseteq U_a\times V_a\subseteq W$.
Now we use the compactness of $A$: $\{U_a:a\in A\}$ is an open cover of $A$ in $X$, so it has a finite subcover $\{U_{a_1},\dots,U_{a_m}\}$. Let $U=\bigcup_{k=1}^mU_{a_k}$ and $V=\bigcap_{k=1}^mV_{a_k}$.
I’ll leave it to you to fill in any missing details and complete the argument by showing that $A\times B\subseteq U\times V\subseteq W$.
