mirror of
https://github.com/kilyabin/psysonic.git
synced 2026-07-22 14:35:41 +00:00
fix(album): contain Artist Biography modal scroll within frame (#734)
* fix(album): contain Artist Biography modal scroll within frame The modal was rendered inside the album page tree, where an ancestor broke `position: fixed` so the overlay scrolled with the page instead of pinning to the viewport. Long bios also pushed the modal past the viewport entirely. - Render `BioModal` via `createPortal(document.body)` so no ancestor's transform/filter/backdrop-filter can break fixed positioning. - New `.modal-content.bio-modal` variant: flex column, `overflow: hidden`. Title + close button stay pinned, only `.bio-modal-body` scrolls. The existing `max-height: 80vh` on `.modal-content` now reliably caps the modal to the visible viewport. Reported by zunoz on Discord. * docs(changelog): note Artist Biography modal scroll fix (#734)
This commit is contained in:
committed by
GitHub
parent
7f9b5bd57d
commit
2233e8fb91
@@ -1,6 +1,7 @@
|
||||
import { buildCoverArtUrl } from '../api/subsonicStreamUrl';
|
||||
import type { EntityRatingSupportLevel, SubsonicOpenArtistRef, SubsonicSong } from '../api/subsonicTypes';
|
||||
import React, { useMemo, useState } from 'react';
|
||||
import { createPortal } from 'react-dom';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { Play, Heart, ExternalLink, X, ChevronLeft, Download, ListPlus, HardDriveDownload, Share2, Highlighter, Loader2, Shuffle } from 'lucide-react';
|
||||
import CachedImage from './CachedImage';
|
||||
@@ -35,14 +36,17 @@ function isVariousArtistsLabel(name: string | undefined | null): boolean {
|
||||
|
||||
function BioModal({ bio, onClose }: { bio: string; onClose: () => void }) {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
return createPortal(
|
||||
<div className="modal-overlay" onClick={onClose} role="dialog" aria-modal="true" aria-label={t('albumDetail.bioModal')}>
|
||||
<div className="modal-content" onClick={e => e.stopPropagation()}>
|
||||
<div className="modal-content bio-modal" onClick={e => e.stopPropagation()}>
|
||||
<button className="modal-close" onClick={onClose} aria-label={t('albumDetail.bioClose')}><X size={18} /></button>
|
||||
<h3 className="modal-title">{t('albumDetail.bioModal')}</h3>
|
||||
<div className="artist-bio" dangerouslySetInnerHTML={{ __html: sanitizeHtml(bio) }} data-selectable />
|
||||
<div className="bio-modal-body">
|
||||
<div className="artist-bio" dangerouslySetInnerHTML={{ __html: sanitizeHtml(bio) }} data-selectable />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>,
|
||||
document.body
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user