Use event.currentTarget instead of event.target

So the command works with the shadow DOM disabled.