Skip to content

Commit

Permalink
fix(player): hide tooltips on mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
mihar-22 committed Oct 3, 2023
1 parent 67fadf6 commit e635ad0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 25 deletions.
25 changes: 2 additions & 23 deletions packages/vidstack/player/styles/default/layouts/video.css
Original file line number Diff line number Diff line change
Expand Up @@ -435,35 +435,14 @@
}

@media (orientation: portrait) {
:where([data-iphone][data-fullscreen] .vds-video-layout .vds-controls-group:first-child) {
margin-top: 48px;
padding-inline: 4px;
}

:where([data-iphone][data-fullscreen] .vds-video-layout .vds-controls-group:nth-last-child(2)) {
padding-inline: 8px;
}

:where([data-iphone][data-fullscreen] .vds-video-layout .vds-controls-group:last-child) {
margin-inline: 8px;
margin-bottom: 52px;
}

:where([data-fullscreen] .vds-video-layout .vds-captions) {
bottom: 30vh;
bottom: 30lvh;
bottom: 10dvh;
}
}

@media (orientation: landscape) {
:where([data-iphone][data-fullscreen]:not([data-controls]) .vds-video-layout .vds-captions) {
bottom: 32px;
}

:where([data-fullscreen] .vds-video-layout .vds-controls-group:nth-last-child(2)) {
margin-bottom: -12px;
}

:where([data-iphone][data-fullscreen] .vds-video-layout .vds-controls-group:last-child) {
margin-bottom: 12px;
}
}
7 changes: 5 additions & 2 deletions packages/vidstack/src/components/ui/tooltip/tooltip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,13 @@ export class Tooltip extends Component<TooltipProps> {
_content: this._content,
_showDelay: showDelay,
_listen(trigger, show, hide) {
listenEvent(trigger, 'touchstart', (e) => e.preventDefault());

listenEvent(trigger, 'focus', show);
listenEvent(trigger, 'pointerenter', show);
listenEvent(trigger, 'blur', hide);
listenEvent(trigger, 'pointerleave', hide);

listenEvent(trigger, 'mouseenter', show);
listenEvent(trigger, 'mouseleave', hide);
},
_onChange: this._onShowingChange.bind(this),
});
Expand Down

0 comments on commit e635ad0

Please sign in to comment.