Droplet breakup in systems with either a viscoelastic matrix or a viscoelastic droplet is studied microscopically in bulk and confined shear flow, using a parallel plate counter rotating shear flow cell. The ratio of droplet diameter to gap spacing is systematically varied between 0.1 and 0.85. In bulk shear flow, the effects of matrix and droplet viscoelasticity on the critical capillary number for breakup are very moderate under the studied conditions. However, in confined conditions a profoundly different behaviour is observed: the critical capillary numbers of a viscoelastic droplet are similar to those of a Newtonian droplet, whereas matrix viscoelasticity causes breakup at a much lower capillary number. The critical capillary numbers ...