1
0
Fork 0

Experiment auto-expand spoiler in hero status

This commit is contained in:
Lim Chee Aun 2024-05-19 18:46:27 +08:00
parent 1b1af67064
commit ad7cb46547

View file

@ -984,6 +984,18 @@ function StatusThread({ id, closeLink = '/', instance: propInstance }) {
[statuses, limit, renderStatus],
);
// If there's spoiler in hero status, auto-expand it
useEffect(() => {
let timer = setTimeout(() => {
if (!heroStatusRef.current) return;
const spoilerButton = heroStatusRef.current.querySelector(
'.spoiler-button:not(.spoiling), .spoiler-media-button:not(.spoiling)',
);
if (spoilerButton) spoilerButton.click();
}, 1000);
return () => clearTimeout(timer);
}, [id]);
return (
<div
tabIndex="-1"