fix: fragmentation
This commit is contained in:
@@ -429,18 +429,30 @@ describe('HomeComponent', (): void => {
|
|||||||
// ── RAF debouncing (performance) ───────────────────────────────────────────
|
// ── RAF debouncing (performance) ───────────────────────────────────────────
|
||||||
|
|
||||||
describe('Performance', (): void => {
|
describe('Performance', (): void => {
|
||||||
it('should keep scroll effects enabled on small viewports when motion is allowed', (): void => {
|
it('should keep scroll effects enabled on desktop pointers when motion is allowed', (): void => {
|
||||||
spyOnProperty(window, 'innerWidth').and.returnValue(390);
|
|
||||||
spyOn(window, 'matchMedia').and.callFake(
|
spyOn(window, 'matchMedia').and.callFake(
|
||||||
(query: string): MediaQueryList =>
|
(query: string): MediaQueryList =>
|
||||||
({
|
({
|
||||||
matches: query !== '(prefers-reduced-motion: reduce)',
|
matches:
|
||||||
|
query !== '(prefers-reduced-motion: reduce)' &&
|
||||||
|
query !== '(hover: none) and (pointer: coarse)',
|
||||||
}) as MediaQueryList,
|
}) as MediaQueryList,
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(comp.shouldEnableScrollEffects()).toBeTrue();
|
expect(comp.shouldEnableScrollEffects()).toBeTrue();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should disable scroll effects on coarse touch pointers', (): void => {
|
||||||
|
spyOn(window, 'matchMedia').and.callFake(
|
||||||
|
(query: string): MediaQueryList =>
|
||||||
|
({
|
||||||
|
matches: query === '(hover: none) and (pointer: coarse)',
|
||||||
|
}) as MediaQueryList,
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(comp.shouldEnableScrollEffects()).toBeFalse();
|
||||||
|
});
|
||||||
|
|
||||||
it('should disable scroll effects when reduced motion is requested', (): void => {
|
it('should disable scroll effects when reduced motion is requested', (): void => {
|
||||||
spyOn(window, 'matchMedia').and.callFake(
|
spyOn(window, 'matchMedia').and.callFake(
|
||||||
(query: string): MediaQueryList =>
|
(query: string): MediaQueryList =>
|
||||||
|
|||||||
@@ -227,8 +227,11 @@ export class HomeComponent implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
const prefersReducedMotion: boolean = window.matchMedia(
|
const prefersReducedMotion: boolean = window.matchMedia(
|
||||||
'(prefers-reduced-motion: reduce)',
|
'(prefers-reduced-motion: reduce)',
|
||||||
).matches;
|
).matches;
|
||||||
|
const usesTouchScrolling: boolean = window.matchMedia(
|
||||||
|
'(hover: none) and (pointer: coarse)',
|
||||||
|
).matches;
|
||||||
|
|
||||||
return !prefersReducedMotion;
|
return !prefersReducedMotion && !usesTouchScrolling;
|
||||||
}
|
}
|
||||||
|
|
||||||
private initNameGradientScrollAnimation(): void {
|
private initNameGradientScrollAnimation(): void {
|
||||||
|
|||||||
+13
-4
@@ -1223,22 +1223,31 @@ hr {
|
|||||||
.projects-section,
|
.projects-section,
|
||||||
.story-section,
|
.story-section,
|
||||||
.legal-section {
|
.legal-section {
|
||||||
content-visibility: auto;
|
content-visibility: visible;
|
||||||
contain-intrinsic-size: 1px 720px;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 700px) and (hover: none) and (pointer: coarse) {
|
@media (hover: none) and (pointer: coarse) {
|
||||||
body {
|
body {
|
||||||
background:
|
background:
|
||||||
radial-gradient(circle at top left, rgba(217, 162, 140, 0.18), transparent 28%),
|
radial-gradient(circle at top left, rgba(217, 162, 140, 0.18), transparent 28%),
|
||||||
radial-gradient(circle at bottom right, rgba(127, 78, 63, 0.24), transparent 32%),
|
radial-gradient(circle at bottom right, rgba(127, 78, 63, 0.24), transparent 32%),
|
||||||
linear-gradient(180deg, rgba(9, 9, 12, 0.72), rgba(8, 8, 11, 0.96)),
|
linear-gradient(180deg, rgba(9, 9, 12, 0.72), rgba(8, 8, 11, 0.96)),
|
||||||
url('assets/optimized/background.webp') center / cover fixed no-repeat;
|
url('assets/optimized/background.webp') center top / cover no-repeat;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (hover: none) and (pointer: coarse) {
|
@media (hover: none) and (pointer: coarse) {
|
||||||
|
.about-scroll-anim-enabled .story-copy,
|
||||||
|
.about-scroll-anim-enabled .story-detail,
|
||||||
|
.project-entry,
|
||||||
|
.project-entry.project-entry-from-right,
|
||||||
|
.project-entry.project-entry-from-left {
|
||||||
|
opacity: 1;
|
||||||
|
transform: none;
|
||||||
|
will-change: auto;
|
||||||
|
}
|
||||||
|
|
||||||
.action-link:hover,
|
.action-link:hover,
|
||||||
.detail-toggle:hover,
|
.detail-toggle:hover,
|
||||||
.back-link:hover,
|
.back-link:hover,
|
||||||
|
|||||||
Reference in New Issue
Block a user