An opportunity attack is described this way:
You can make an opportunity attack when a hostile creature that you can see moves out of your reach. To make the opportunity attack, you use your reaction to make one melee attack against the provoking creature.
The War Caster feat has this benefit:
When a hostile creature’s movement provokes an opportunity attack from you, you can use your reaction to cast a spell at the creature, rather than making an opportunity attack. The spell must have a casting time of 1 action and must target only that creature.
Without the Crossbow Expert feat, all ranged attacks (including ranged spell attacks) made when an enemy is adjacent suffer this penalty (PHB p. 206):
You have disadvantage on a ranged attack roll if you are within 5 feet of a hostile creature that can see you and that isn’t incapacitated.
As an opportunity attack normally grants a melee attack, does it seem reasonable to assume that the target remains at melee range for the spell attack granted by War Caster? If so, does this require ranged spell attack rolls to be made with disadvantage?
The trigger for an OA is a creature moving "out of your reach". This suggests to me that the creature is out of the 5' disadvantage zone, but it seems like that would preclude making a melee spell attack.
Do characters with the War Caster feat get the best of both worlds: being allowed to make either a melee spell attack or a non-disadvantaged ranged spell attack?