The idea that gravity disappears when matter is converted into electromagnetic waves is not supported by our current understanding of physics. In the context of general relativity, which is our best theory of gravity, matter and energy, including electromagnetic waves, contribute to the curvature of spacetime and, therefore, to the gravitational field.
Dark matter is a concept introduced to explain the observed gravitational effects in the universe that cannot be accounted for by visible matter, such as stars, galaxies, and gas. Dark matter does not emit, absorb, or interact significantly with electromagnetic radiation, which is why it is referred to as "dark." Its presence is inferred based on the gravitational effects it exerts on visible matter.
The effects attributed to dark matter, such as the rotation curves of galaxies and the gravitational lensing of light, cannot be explained solely by the visible matter and known forms of energy. Dark matter is postulated to be some form of non-luminous matter that interacts primarily through gravity. Various candidates for dark matter, such as weakly interacting massive particles (WIMPs), have been proposed, but their exact nature remains a subject of ongoing research.
In summary, the disappearance of gravity when matter is converted into electromagnetic waves is not a valid explanation for the effects observed and attributed to dark matter. Dark matter is invoked to account for the gravitational phenomena that cannot be explained by visible matter alone, and it is considered distinct from electromagnetic radiation.