The Magisterium has never taught that the first eleven chapters of Genesis are to be understood in an entirely literal manner. And it is an open question as to whether we should understand the story of the Flood to be entirely literal, entirely figurative, or a mix of figurative and literal elements. My position is the latter.
Pope Benedict XV:
"Jerome says that all interpretation rests on the literal sense, and that we are not to think that there is no literal sense merely because a thing is said metaphorically, for ‘the history itself is often presented in metaphorical dress and described figuratively.’ "
My view is that the story of Noah and the Flood is an historical event, but one that is described figuratively and metaphorically in some of its elements.
"53. On this point he [St. Jerome] makes the wise remark that we ought not to desert the path mapped out by Christ and His Apostles, who, while regarding the Old Testament as preparing for and foreshadowing the New Covenant, and whilst consequently explaining various passages in the former as figurative, yet do not give a figurative interpretation of all alike. In confirmation of this he often refers us to St. Paul, who, when ‘explaining the mystery of Adam and Eve, did not deny that they were formed, but on that historical basis erected a spiritual interpretation, and said: “Therefore shall a man leave,” etc.’ "
(Pope Benedict XV, Spiritus Paraclitus)
So, some of the elements in OT stories are literal, and others are figurative. It is a mix of figurative and literal elements, not wholly one or the other. This is particularly true in the stories from Genesis 1 to 11.