There's caffeine and sugar in it, seems reasonable, plus the pleasure of it means more endorphins. That's like three direct up-regulators of brain function.
Well the researchers say in the article that sugar should impair cognition.
Caffeine and feeling good are confounders, as they aren't unique to chocolate. The researchers are proposing that it is some kind of special ingredient in chocolate you can't really get anywhere else easily that enhances cognitive function.