A few years ago, the Canadian government (at that time it was a majority Conservative government under Stephen Harper) proposed legislation which would have weakened the privacy rights of all Canadians. Part of the justification was to allow easier apprehension and prosecution of people trafficking in child pornography. The justice minister, Vic Toews, said that anyone opposing the bill was in favour of child pornography. Of course, this was a ridiculous statement, creating a false dichotomy of "you're either with us or against us".
Similarly, the media seems intent on painting anyone who favoured Great Britain's exit from the European Union as Islamophobic or Xenophobic. Almost certainly this was a factor in the minds of some of the voters. However, it may also be that many of the voters felt that Great Britain had lost control over matters affecting them that are better handled from within Great Britain than from without. I've seen the effect that globalization has had on the economies of both Canada and the United States. The FTA, and its successor, NAFTA, both resulted in the outsourcing of millions of jobs to other countries. When NAFTA was first passed, seminars were routinely held for big business to show how they could save billions by shipping manufacturing jobs to Mexico and other countries. Globalization worked to the benefit of big business and to the detriment of American and Canadian workers. Globalization is not necessarily desirable nor inevitable but it is far easier for those who would profit from globalization to paint those who oppose it as racist rather than anti big business.