enabling optional context to make it work with modal windows

Hi there, I did a minor edit to make it usable with modal windows. Feel free to merge or not merge this. :)