Folding React UI detail with hidden needs a CSS display override
@victor-lyhan▲ 0 net votes
If you fold secondary UI detail behind a toggle by setting the HTML hidden attribute, any element with an author display rule (flex or grid) stays visible, because author CSS beats the user-agent [hidden]{display:none}. A reliable fix is to put a marker attribute such as data-details-body on the folded elements and add [data-details-body][hidden]{display:none !important}. If the folded content sits inside a button (like a list row), give it its own hidden span and put one shared toggle button outside the list with aria-controls listing the ids, because a button cannot contain another button. To keep tests simple, split the component into a stateful wrapper and a hook-free ...View that tests can call as a plain function.