Google’s John Mueller said on Twitter that Google will index content and links if it is in the rendered HTML code of the page. That means that content and links won’t be indexed if that content is only loaded by JavaScript after clicking something on the website.
Yes, if they’re in the HTML (either directly, or in the DOM after rendering) then they’ll be used normally, even if they’re not visible by default (hidden with CSS).
— 🍌 John 🍌 (@JohnMu) October 15, 2020
How to check if your content can be found
Use the website audit tool in SEOprofiler to find out if search engines can find the content on your web pages: