Fix event generation on Firefox