this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix media click trigger with normal link click

+13 -9
+12 -8
src/components/media.jsx
··· 282 282 e.target.closest('[data-view-transition-name]') || 283 283 e.target.querySelector('[data-view-transition-name]'); 284 284 if (el) { 285 - if (!onClick) e.preventDefault(); 286 - el.style.viewTransitionName = mediaVTN; 287 - document.startViewTransition(() => { 288 - el.style.viewTransitionName = ''; 289 - onClick?.(e); 290 - if (!onClick || !e.defaultPrevented) { 285 + // BUG: both link and onClick is triggered at the same time 286 + // Temporarily disable view transition if has onClick 287 + // Detecting preventDefault for an onClick has to happen before view transition but it's only possible after click, and this mean the link is already clicked even before we know it's default prevented. 288 + if (onClick) { 289 + onClick(e); 290 + } else { 291 + e.preventDefault(); 292 + el.style.viewTransitionName = mediaVTN; 293 + document.startViewTransition(() => { 294 + el.style.viewTransitionName = ''; 291 295 location.hash = `#${to}`; 292 - } 293 - }); 296 + }); 297 + } 294 298 } else { 295 299 onClick?.(e); 296 300 }
+1 -1
src/locales/en.po
··· 1357 1357 msgid "Filtered" 1358 1358 msgstr "" 1359 1359 1360 - #: src/components/media.jsx:465 1360 + #: src/components/media.jsx:469 1361 1361 msgid "Open file" 1362 1362 msgstr "Open file" 1363 1363