While I agree it seems absurd, this is how the UK's unwritten constitution works - the UK Parliament is not restricted to legislating just for the territory of the UK. Of course it can only realistically enforce within UK borders, but it can pass whatever legislation it wishes.
There is a famous quote regarding this nature of British parliamentary sovereignty that is taught to every law student in the UK: "If Parliament enacts that smoking in the streets of Paris is an offence, then it is an offence" - Ivor Jennings.