diff --git a/src/components/media-modal.jsx b/src/components/media-modal.jsx index 0c70fbbc..f100278f 100644 --- a/src/components/media-modal.jsx +++ b/src/components/media-modal.jsx @@ -176,6 +176,7 @@ function MediaModal({ left: carouselRef.current.clientWidth * i, behavior: 'smooth', }); + carouselRef.current.focus(); }} > • @@ -245,6 +246,7 @@ function MediaModal({ left: carouselRef.current.clientWidth * (currentIndex - 1), behavior: 'smooth', }); + carouselRef.current.focus(); }} > @@ -260,6 +262,7 @@ function MediaModal({ left: carouselRef.current.clientWidth * (currentIndex + 1), behavior: 'smooth', }); + carouselRef.current.focus(); }} > @@ -272,6 +275,7 @@ function MediaModal({ onClick={(e) => { if (e.target === e.currentTarget) { setShowMediaAlt(false); + carouselRef.current.focus(); } }} > diff --git a/src/components/media.jsx b/src/components/media.jsx index 9c688572..da67646b 100644 --- a/src/components/media.jsx +++ b/src/components/media.jsx @@ -116,12 +116,18 @@ function Media({ media, to, showOriginal, autoAnimate, onClick = () => {} }) { if (smaller) setImageSmallerThanParent(smaller); }, [width, height]); + const maxAspectHeight = + window.innerHeight * (orientation === 'portrait' ? 0.45 : 0.33); + const maxHeight = orientation === 'portrait' ? 0 : 160; const mediaStyles = { '--width': `${width}px`, '--height': `${height}px`, + // Calculate '--aspectWidth' based on aspect ratio calculated from '--width' and '--height', max height has to be 160px + '--aspectWidth': `${ + (width / height) * Math.max(maxHeight, maxAspectHeight) + }px`, aspectRatio: `${width} / ${height}`, }; - const fixedWidth = width > height * 2; if (isImage) { // Note: type: unknown might not have width/height @@ -143,7 +149,7 @@ function Media({ media, to, showOriginal, autoAnimate, onClick = () => {} }) { return ( {} }) { *, -.status .content-container.has-spoiler .spoiler ~ .card > img { +.status + .content-container.has-spoiler:not(.show-spoiler) + .spoiler + ~ .media-container + .media + > *, +.status + .content-container.has-spoiler:not(.show-spoiler) + .spoiler + ~ .card + > img { filter: blur(32px); image-rendering: crisp-edges; image-rendering: pixelated; @@ -418,7 +431,7 @@ .status .content-container.show-spoiler .spoiler { border-style: dotted; } -.status +/* .status .content-container.show-spoiler .spoiler ~ *:not(.media-container, .card), @@ -434,7 +447,7 @@ .status .content-container.show-spoiler .spoiler ~ .card > img { filter: none; image-rendering: auto; -} +} */ /* .status .content a:not(.mention):not(:has(span)) { color: inherit; } */ @@ -597,28 +610,31 @@ display: inline-block; max-width: 100% !important; min-width: 44px; - width: auto; + /* width: auto; */ min-height: 44px; - /* width: min(var(--width), 100%); */ - /* max-height: min(var(--height), 33vh); */ - height: min(160px, var(--height), 33vh); -} -.status .media-container.media-eq1 .media.media-fixed-width { - width: min(var(--width), 100%); - height: auto; + /* --maxAspectHeight: max(160px, 33vh); + --aspectWidth: calc(--width / --height * var(--maxAspectHeight)); */ + width: min(var(--aspectWidth), var(--width), 100%); max-height: min(var(--height), 33vh); } .status .media-container.media-eq1 .media[data-orientation='portrait'] { - width: auto; + /* width: auto; height: min(var(--height), 45vh); - max-height: none; + max-height: none; */ + max-height: min(var(--height), 45vh); } .status.large .media-container.media-eq1 { max-height: min(var(--height), 60vh); } -.status.large .media-container.media-eq1 .media[data-orientation='portrait'] { - height: min(var(--height), 60vh); +.status.large + .media-container:not(.status-card .media-container).media-eq1 + .media { + width: min(var(--width), 100%); + max-height: min(var(--height), 80vh); } +/* .status.large .media-container.media-eq1 .media[data-orientation='portrait'] { + height: min(var(--height), 60vh); +} */ .status-carousel .status .media-container.media-eq1 .media { width: min(var(--width), 100%); height: auto; @@ -999,6 +1015,9 @@ a:focus-visible .card img { overflow: hidden; display: block; } +.card .meta.domain * { + vertical-align: middle; +} a.card { text-decoration: none; transition: opacity 0.2s ease-in-out; diff --git a/src/components/status.jsx b/src/components/status.jsx index d57050f2..1e7e83a0 100644 --- a/src/components/status.jsx +++ b/src/components/status.jsx @@ -1449,7 +1449,7 @@ function Card({ card, instance }) { if (snapStates.unfurledLinks[url]) return null; - if (hasText && (image || (!type !== 'photo' && blurhash))) { + if (hasText && (image || (type === 'photo' && blurhash))) { const domain = new URL(url).hostname.replace(/^www\./, ''); let blurhashImage; if (!image) { @@ -1541,7 +1541,9 @@ function Card({ card, instance }) { class={`card link no-image`} >
-

{domain}

+

+ {domain} +

{title}

{description || providerName || authorName}

diff --git a/src/pages/status.jsx b/src/pages/status.jsx index 09f298ce..8afa7050 100644 --- a/src/pages/status.jsx +++ b/src/pages/status.jsx @@ -843,24 +843,24 @@ function StatusThread({ id, closeLink = '/', instance: propInstance }) { weight, } = status; const isHero = statusID === id; - const StatusParent = useCallback( - (props) => - isThread || thread ? ( - { - resetScrollPosition(statusID); - }} - {...props} - /> - ) : ( -
- ), - [isThread, thread], - ); + // const StatusParent = useCallback( + // (props) => + // isThread || thread || ancestor ? ( + // { + // resetScrollPosition(statusID); + // }} + // {...props} + // /> + // ) : ( + //
+ // ), + // [isThread, thread], + // ); return (
  • ) : ( - + // + { + resetScrollPosition(statusID); + }} + >
  • )} */} - + {/* */} + )} {descendant && replies?.length > 0 && ( {replies.map((r) => (
  • - {/* { resetScrollPosition(r.id); }} - > */} -
    + > + {/*
    */}
    )} -
    - {/* */} + {/*
  • */} + {r.replies?.length && (