Skip to content

Commit

Permalink
Fix contact links interaction on mobile devices
Browse files Browse the repository at this point in the history
  • Loading branch information
BetaMac committed Dec 11, 2024
1 parent 0e9301d commit 5be2f5d
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/components/Portfolio.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,12 @@ export default function Portfolio() {
const target = e.target as HTMLElement
const header = document.querySelector('header')
const mobileMenu = document.querySelector('nav.mobile-menu')
const contactLinks = document.querySelectorAll('a')

// Allow touch events if we're interacting with the header/menu
if (header?.contains(target) || mobileMenu?.contains(target)) {
// Allow touch events if we're interacting with the header/menu or links
if (header?.contains(target) ||
mobileMenu?.contains(target) ||
Array.from(contactLinks).some(link => link.contains(target))) {
return
}

Expand All @@ -62,9 +65,12 @@ export default function Portfolio() {
const target = e.target as HTMLElement
const header = document.querySelector('header')
const mobileMenu = document.querySelector('nav.mobile-menu')
const contactLinks = document.querySelectorAll('a')

// Allow touch events if we're interacting with the header/menu
if (header?.contains(target) || mobileMenu?.contains(target)) {
// Allow touch events if we're interacting with the header/menu or links
if (header?.contains(target) ||
mobileMenu?.contains(target) ||
Array.from(contactLinks).some(link => link.contains(target))) {
return
}

Expand Down

0 comments on commit 5be2f5d

Please sign in to comment.