Skip to content

Commit

Permalink
Remove any-pointer: coarse
Browse files Browse the repository at this point in the history
This matches if *any* of the inputs are touch, we only want to match if
*all* inputs are touch
Unfortunately, this is broken in Chrome, but new query should be correct
by spec at least
  • Loading branch information
cpiber committed Aug 24, 2024
1 parent 0795652 commit f8e4130
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/scripts/helpers/shared/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const calcOuterBounds = (e: HTMLElement) => {
return { rect: r, offset: oldx - r.x };
};

export const isMobile = () => window.matchMedia('(any-pointer: coarse), (any-hover: none)').matches;
export const isMobile = () => window.matchMedia('(any-hover: none)').matches;
export const isVideoPage = () => !!window.location.pathname.match(videoUrlMatch);
export const isVideoListPage = () => !!window.location.pathname.match(knownHomeRegex) || !!window.location.pathname.match(/^\/(videos\/?|myshows\/?|library|library\/.*|explore\/.*)$/);
export const getBase = () => 'nebula.tv';
Expand Down
3 changes: 2 additions & 1 deletion src/styles/helpers/mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
}
}

// not always correct, see https://patrickhlauke.github.io/touch/pointer-hover-any-pointer-any-hover/results/
@mixin mobile() {
@media (any-pointer: coarse), (any-hover: none) {
@media (any-hover: none) {
@content;
}
}
Expand Down

0 comments on commit f8e4130

Please sign in to comment.