So to cover that, typically law basically defaults on granting your company IP rights on anything you create anytime while you're an employee, and should there be need to challenge that, it's up to you to uphold in court that project X has nothing to do with your company business or tech, or to ensure beforehand that your contract has special provisions granting you IP rights in known situations.
† At the very least this is also the basis as to why software is not patentable in EU, unless they are an integral part of a very concrete process that itself solves an issue (e.g say you invent an industrial process that allows you to synthesize molecule X more efficiently, and that process involves a bit of code as an integral and required part of said process because it is deeply tied to it in a fundamental way, then that precise bit of software can be covered by the patent of the process)
The first draft of my current contract wanted a claim to all creative work produced, at all hours, on any equipment, in any medium. (e.g. the copyright on a photo I took on holiday would technically have been owned by my employer.)
They also wanted me to give up all "moral rights" which meant I could not say I created anything I did while being employed, and more worryingly, I could not say I didn't create something that the company said I did.
That clause got removed pretty damn quickly.