I'm not as familiar with EU laws, but if I posted this joke online in the UK, then yes, it could easily be considered "grossly offensive" and therefore would be illegal.
I won't say it happens particularly often, but we do charge people in the UK for posting offensive jokes. Hell, you can be charged for saying something factually true if it's offensive in the UK.