fix: restore case study drawer interactions

This commit is contained in:
2026-09-09 23:17:39 +03:30
parent 24cd86ede7
commit b87a1be8fc
6 changed files with 22 additions and 19 deletions

View File

@@ -74,7 +74,7 @@ export function CaseStudyDrawer({ children, locale }: { children: ReactNode; loc
root.style.overflow = 'hidden';
requestAnimationFrame(() => {
dialog.dataset.state = 'open';
dialog.querySelector<HTMLElement>('[data-case-study-heading]')?.focus();
dialog.querySelector<HTMLElement>('[data-case-study-initial-focus]')?.focus();
});
return () => {
@@ -96,7 +96,7 @@ export function CaseStudyDrawer({ children, locale }: { children: ReactNode; loc
scrollRef.current?.scrollTo({ top: 0, behavior: 'auto' });
requestAnimationFrame(() => {
setCopyState('idle');
dialogRef.current?.querySelector<HTMLElement>('[data-case-study-heading]')?.focus();
dialogRef.current?.querySelector<HTMLElement>('[data-case-study-initial-focus]')?.focus();
});
}, [pathname]);
@@ -145,7 +145,14 @@ export function CaseStudyDrawer({ children, locale }: { children: ReactNode; loc
{copyState === 'copied' ? <Check size={19} aria-hidden="true" /> : <Copy size={18} aria-hidden="true" />}
<span className={styles.actionText}>{copyState === 'copied' ? copy.linkCopied : copy.copyLink}</span>
</button>
<button type="button" className={styles.iconButton} onClick={(event) => requestDismiss(event.detail !== 0)} aria-label={copy.closeCaseStudy}>
<button
type="button"
className={styles.iconButton}
onClick={(event) => requestDismiss(event.detail !== 0)}
aria-label={copy.closeCaseStudy}
data-case-study-initial-focus
autoFocus
>
<X size={21} aria-hidden="true" />
</button>
</div>