Skip to content

Commit 0b84541

Browse files
authored
Replace ontouch with onclick (#729)
* 1.16.0 * replace ontouch with onclick
1 parent ba36ac3 commit 0b84541

File tree

3 files changed

+2
-12
lines changed

3 files changed

+2
-12
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
},
2525
"types": "./dist/widgets.d.ts",
2626
"private": true,
27-
"version": "1.15.5",
27+
"version": "1.16.0",
2828
"engines": {
2929
"node": ">=14.0.0"
3030
},

src/custom/components/Header/MobileMenuIcon/index.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ interface IconProps {
6767
width?: number
6868
height?: number
6969
lineSize?: number
70-
onTouchStart?: () => void
7170
onClick?: () => void
7271
}
7372

src/custom/components/Header/index.tsx

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ export default function Header() {
8484
const isUpToSmall = useMediaQuery(upToSmall)
8585
const isLargeAndUp = useMediaQuery(LargeAndUp)
8686

87-
const [isTouch, setIsTouch] = useState<boolean>(false)
8887
const [isMobileMenuOpen, setIsMobileMenuOpen] = useState(false)
8988
const handleMobileMenuOnClick = useCallback(() => {
9089
isUpToLarge && setIsMobileMenuOpen(!isMobileMenuOpen)
@@ -94,8 +93,6 @@ export default function Header() {
9493
// This removes the inner scrollbar on the page body, to prevent showing double scrollbars.
9594
useEffect(() => {
9695
isMobileMenuOpen ? addBodyClass('noScroll') : removeBodyClass('noScroll')
97-
// Set if device has touch capabilities
98-
setIsTouch('ontouchstart' in document.documentElement)
9996
}, [isOrdersPanelOpen, isMobileMenuOpen, isUpToLarge, isUpToMedium, isUpToSmall, isLargeAndUp])
10097

10198
return (
@@ -137,13 +134,7 @@ export default function Header() {
137134
</HeaderElement>
138135
</HeaderControls>
139136

140-
{isUpToLarge && (
141-
<MobileMenuIcon
142-
isMobileMenuOpen={isMobileMenuOpen}
143-
onTouchStart={handleMobileMenuOnClick}
144-
onClick={isTouch ? undefined : handleMobileMenuOnClick} // Disable onClick on touch devices and use onTouchStart
145-
/>
146-
)}
137+
{isUpToLarge && <MobileMenuIcon isMobileMenuOpen={isMobileMenuOpen} onClick={handleMobileMenuOnClick} />}
147138
{isOrdersPanelOpen && <OrdersPanel handleCloseOrdersPanel={handleCloseOrdersPanel} />}
148139
</HeaderModWrapper>
149140
</Wrapper>

0 commit comments

Comments
 (0)