Often the other spouse picks up the issue - not always on a completely consicous level. so it is not necessarily the case that the spouse with the attraction can actually keep it hidden.
Given the damaging dynamics that type of thing most often seems to bring, I don’t know if the question has an answer; or at least, an answer that amounts to anything more than wishful thinking.
There are those who wish to stick their head in the sand - never want to know about it and secretly hope it will all go away.
There are those who wish to know, on the assumption that they can do anything about it.
Not knowing on the conscious level - that is, on the level where the wtonged spouse admits it to themselves that their spouse is being at least emotionaly unfaithful - often leads to emotional reactions and responses that often cause the philandering spouse to move farther away, rather than back to their spouse.
On the other hand, knowing it on a conscious level often leads to open conflict about the issue. Most people are not willing or able to stand aside while the philandering spouse “works it out”, and that can lead to emotional scenes of pleading, anger, bargaining, and other messy responses which often do not help to clear anything up.
The saddest part is that, while we are children, we do not have barriers up emotionally, and often are able to see and understand what is going on around us; as we grow older, we start to put up barriers, and in part, convince ourselves that we know nothing. However, most people who are at least minimally alert will pick up tell-tales that something is amiss. That, in turn, usually leads to responses to the spouse with the “attraction”, much, if not most of which is not particularly helpful to the situation.