As often as possible, your fingers play on the front white portion of the keys. When playing a black key is necessary, you may have to move in closer to the fallboard -- depends on the notes preceding and following the black key -- or more specifically which fingers must be used to play the black key.
As soon as possible, my teacher is teaching me to move my hand back to the front white portion of the keys. Last lesson she had me explore why -- play a white key as you have been -- then play a black key and now continue to play the nearby white keys at the back of the keys near the fallboard-- in effect between the black keys. Next, after playing the black key slide back out and play the white keys at the front -- do you feel how much more weight was needed to play at the back of the white keys vs. the front??
You never want to use any more effort than necessary to play the keys -- black or white.
depending on the finger used for the black key sometimes only a slight stretch is needed to play it, in which case it is not necessary to slide inside close to the fallboard.
Does this make sense? I can describe actual examples from my current music if the above description is not clear.