From a socialist point of view, the EU has always presented something of a dilemma. The idea of the EU represented some important aspects of our socialist hopes: more international cooperation, less nationalist competition between workers, the idea of international labour and safety regulations, etc. In a globalizing world, a world where things like labour laws, environmental protections, and health and safety regulations all have international implications and impacts, the more international cooperation we can get the better.
Years ago when I lived in England, I was shocked to find out just how lax labour rights were in that country. And because England had opted out of the labour portion of the Maastricht Treaty, there seemed to be little that British workers could do. At the time you could be compelled to work 80 hours a week with no overtime pay, and if you refused you could be summarily dismissed and receive no unemployment money. The only way that workers partially overcame this terrible aspect of the labour market was by taking the British government to the EU and arguing that such condition violated the health and safety aspects of European law, which included aspects that the British Government had not opted out of. I don't know where things stand now because those events occurred nearly 25 years ago and I am sure that much has happened since, but this is an example of why the left held out a great deal of hope for what the European Union represented.
On the other hand, from a socialist point of view, the EU is also problematic, as demonstrated in the Morning Star's call for a leave vote. The Morning Star (once known as The Daily Worker) is a long standing socialist paper in Britain which, though once tainted with Stalinism, is the only Socialist daily in Britain. In the lead up to the Brexit vote the editors at the Morning Star reminded its readers that the EU hardly represents socialist ideals. In fact, as they also remind us, the great Tony Benn once said that the treaties of the EU are the "only constitution in the world committed to capitalism." If a genuinely socialist government were elected in any of the EU states, it would be largely unable to undertake a socialist legislative commitment. The Morning Star further points out that though there is a European Parliament, it is a largely "toothless" body and a great deal of what the EU does it does through de facto executive orders and a central bank. Perhaps the most troubling and telling actions of the EU in recent years, from a socialist point of view, is the way a democratically elected, left-wing government in Greece was treated. Instead of being able to enact socialist policies, the EU forced onto Greece one of the most horrendous austerity package in the world, a decision that has lead to terrible poverty, suffering, and even death.
These events led the editors at the Morning Star to say this - "Those who argue that austerity is a choice being made at a national level should ask why it is that governments ostensibly on the left in France and Italy are attacking worker's rights and public spending just as viciously as governments on the right. Seemingly it doesn't matter who we Europeans elect any more: austerity is what we get."
One of the primary problems with the EU is that it has been designed to resist reform. It's primary regulatory systems are enacted through treaties and those treaties require unanimous agreement to change. Economic treaties are fundamentally problematic from a socialist point of view, as anyone familiar with the TPP and NAFTA know. Many international treaties are designed to rob national governments the ability to undertake legislative protections of their workers and environment and often give corporations the power to force governments to do things that are against the national interests. This is why rightwing governments have been so eager to undertake these treaties; they know that they can tie the hands of future governments, which might be of a more leftwing persuasion, from undertaking legislative reforms of capitalism.
The rightwing has very different reasons for rejecting bodies like the EU, and these reasons are often racist and xenophobic. And this is where things get tricky and confusing. Rightwing populist rhetoric often takes a good game around sovereignty and national interests, but rightwing populists almost never follow up on such rhetoric. Politicians like Trump will yell and scream about international treaties and the problems that American workers face because of internationalized labour markets, but once elected, it's business as usual (and in the interests of business). The last thing a man like Trump wants is for working people to democratically decide upon a collective future. In many ways the EU is no different, it does enact certain protections for workers and the environment, but overall it mostly represents the interests of a capitalist elite. The problem is, of course, that many of those who are arguing against the EU are, in fact, so rightwing that they want even more freedom to exploit their workers and their environment than the structure of the EU allows.
It seems to be that any worker who is not confused, doesn't know what's going on.