Textposition changes automatically in slider animation

I have an animated bar chart and I want the text to stay outside the bar charts the entire code. But when I set the textpostion, it changes as soon as the animation starts and goes back inside the bars.

fig.update_traces(textposition=‘outside’)