fix chrome shitpost mode video preview in upload

This commit is contained in:
2026-07-15 17:41:58 +02:00
parent a613d01873
commit 9e9fd4adf3
2 changed files with 31 additions and 14 deletions

View File

@@ -1415,7 +1415,17 @@ window.initUploadForm = (selector) => {
}
// preview-media-small sizing only applies to standalone (non-col) media
if (!mediaCol) {
mediaElem.classList.add('preview-media-small');
// In shitpost mode, wrap videos in a rigid container to prevent Chrome from
// expanding the video element when native controls are clicked
if (isShitpost && mediaElem.tagName === 'VIDEO') {
const videoWrapper = document.createElement('div');
videoWrapper.className = 'preview-media-small preview-video-wrapper';
mediaElem.style.cssText = 'width:100%;height:100%;display:block;object-fit:contain;';
videoWrapper.appendChild(mediaElem);
mediaElem = videoWrapper;
} else {
mediaElem.classList.add('preview-media-small');
}
}
// If URL item: finish building the media column (media + badge below)