My daughter is 10. She was 9 when the discovery happened. We sat her down together. We talked about what she knows about being gay, pride, all those things. Throughout her life, we've used inclusive language. We have many books that represent different people, families, and relationship models. I remember a moment of pride when she was talking about an aunt and asked if she had a girlfriend or a boyfriend (yes, this is binary, but baby steps - she was, like, six).
When we sat her down, we explained to her that while her father and I still care for each other, and we love her and will always be her parents, her daddy had realized that he is gay and that meant that we weren't going to be married anymore. As we've had changes in the home - him moving into the spare room, him moving out - we've made sure to keep her in the loop before these things happen.
I didn't tell her about the affair and I won't. It's not her burden to bear, nor are my feelings her responsibility. I want to ensure that her relationship with her father is as whole as it can be given that he chose to leave - and I don't think he realized that in leaving our home, he also left her. If when she's an adult, she has more questions, I'll gauge things then.