Skip empty tooltips

This commit is contained in:
Yiannis Christodoulou 2025-10-10 10:30:29 +03:00
parent 4bec15fad5
commit 816135266c
3 changed files with 31 additions and 22 deletions

View File

@ -6,8 +6,8 @@
position: relative; position: relative;
} }
/* Universal tooltip styling for all buttons */ /* Universal tooltip styling for all buttons - only show when title is not empty */
.video-js .vjs-control-bar .vjs-control::after { .video-js .vjs-control-bar .vjs-control[title]:not([title=""]):not([title=" "])::after {
content: attr(title); content: attr(title);
position: absolute; position: absolute;
bottom: 100%; bottom: 100%;
@ -40,8 +40,8 @@
/* Show tooltip on hover and focus for desktop */ /* Show tooltip on hover and focus for desktop */
@media (hover: hover) and (pointer: fine) { @media (hover: hover) and (pointer: fine) {
.video-js .vjs-control-bar .vjs-control:hover::after, .video-js .vjs-control-bar .vjs-control[title]:not([title=""]):not([title=" "]):hover::after,
.video-js .vjs-control-bar .vjs-control:focus::after { .video-js .vjs-control-bar .vjs-control[title]:not([title=""]):not([title=" "]):focus::after {
opacity: 1; opacity: 1;
visibility: visible; visibility: visible;
transform: translateX(-50%) translateY(-2px); transform: translateX(-50%) translateY(-2px);
@ -49,47 +49,50 @@
} }
/* Specific button tooltips - override content when needed */ /* Specific button tooltips - override content when needed */
.video-js .vjs-play-control::after { .video-js .vjs-play-control[title]:not([title=""]):not([title=" "])::after {
content: attr(title); content: attr(title);
} }
.video-js .vjs-mute-control::after { .video-js .vjs-mute-control[title]:not([title=""]):not([title=" "])::after {
content: attr(title); content: attr(title);
} }
.video-js .vjs-fullscreen-control::after { .video-js .vjs-fullscreen-control[title]:not([title=""]):not([title=" "])::after {
content: attr(title); content: attr(title);
} }
.video-js .vjs-picture-in-picture-toggle::after { .video-js .vjs-picture-in-picture-toggle[title]:not([title=""]):not([title=" "])::after {
content: attr(title); content: attr(title);
} }
.video-js .vjs-subtitles-button::after { .video-js .vjs-subtitles-button[title]:not([title=""]):not([title=" "])::after {
content: attr(title);
}
.video-js .vjs-subs-caps-button[title]:not([title=""]):not([title=" "])::after {
content: attr(title); content: attr(title);
} }
.video-js .vjs-chapters-button::after { .video-js .vjs-chapters-button[title]:not([title=""]):not([title=" "])::after {
content: attr(title); content: attr(title);
} }
/* Custom button tooltips */ /* Custom button tooltips */
.video-js .vjs-autoplay-toggle::after { .video-js .vjs-autoplay-toggle[title]:not([title=""]):not([title=" "])::after {
content: attr(title); content: attr(title);
} }
.video-js .vjs-next-video-button::after { .video-js .vjs-next-video-button[title]:not([title=""]):not([title=" "])::after {
content: attr(title); content: attr(title);
} }
.video-js .vjs-settings-button::after { .video-js .vjs-settings-button[title]:not([title=""]):not([title=" "])::after {
content: attr(title); content: attr(title);
left: auto !important; left: auto !important;
right: 0 !important; right: 0 !important;
transform: translateX(-10px) !important; transform: translateX(-10px) !important;
} }
.video-js .vjs-remaining-time::after { .video-js .vjs-remaining-time[title]:not([title=""]):not([title=" "])::after {
content: attr(title); content: attr(title);
} }
@ -101,7 +104,7 @@
} }
/* Show tooltip when touch-active class is added */ /* Show tooltip when touch-active class is added */
.video-js .vjs-control-bar .vjs-control.touch-tooltip-active::after { .video-js .vjs-control-bar .vjs-control[title]:not([title=""]):not([title=" "]).touch-tooltip-active::after {
display: block; display: block;
opacity: 1; opacity: 1;
visibility: visible; visibility: visible;
@ -111,7 +114,7 @@
/* Tablet-specific adjustments */ /* Tablet-specific adjustments */
@media (min-width: 768px) and (max-width: 1024px) and (hover: none) { @media (min-width: 768px) and (max-width: 1024px) and (hover: none) {
.video-js .vjs-control-bar .vjs-control.touch-tooltip-active::after { .video-js .vjs-control-bar .vjs-control[title]:not([title=""]):not([title=" "]).touch-tooltip-active::after {
font-size: 14px; font-size: 14px;
padding: 10px 14px; padding: 10px 14px;
} }
@ -119,7 +122,7 @@
/* Mobile-specific adjustments */ /* Mobile-specific adjustments */
@media (max-width: 767px) { @media (max-width: 767px) {
.video-js .vjs-control-bar .vjs-control.touch-tooltip-active::after { .video-js .vjs-control-bar .vjs-control[title]:not([title=""]):not([title=" "]).touch-tooltip-active::after {
font-size: 12px; font-size: 12px;
padding: 6px 10px; padding: 6px 10px;
margin-bottom: 8px; margin-bottom: 8px;

View File

@ -19,7 +19,6 @@ class EndScreenOverlay extends Component {
// Method to update related videos after initialization // Method to update related videos after initialization
setRelatedVideos(videos) { setRelatedVideos(videos) {
this.relatedVideos = videos || []; this.relatedVideos = videos || [];
console.log('Updated relatedVideos:', this.relatedVideos);
} }
createEl() { createEl() {
@ -62,7 +61,6 @@ class EndScreenOverlay extends Component {
// Get videos to show - access directly from options during createEl // Get videos to show - access directly from options during createEl
const relatedVideos = this.options_?.relatedVideos || this.relatedVideos || []; const relatedVideos = this.options_?.relatedVideos || this.relatedVideos || [];
console.log('createGrid relatedVideos:', relatedVideos);
const videosToShow = const videosToShow =
relatedVideos.length > 0 relatedVideos.length > 0

View File

@ -43,6 +43,8 @@ const enableStandardButtonTooltips = (player) => {
fullscreenToggle: () => (player.isFullscreen() ? 'Exit fullscreen' : 'Fullscreen'), fullscreenToggle: () => (player.isFullscreen() ? 'Exit fullscreen' : 'Fullscreen'),
pictureInPictureToggle: 'Picture-in-picture', pictureInPictureToggle: 'Picture-in-picture',
subtitlesButton: 'Subtitles/CC', subtitlesButton: 'Subtitles/CC',
captionsButton: 'Captions',
subsCapsButton: 'Subtitles/CC',
chaptersButton: 'Chapters', chaptersButton: 'Chapters',
audioTrackButton: 'Audio tracks', audioTrackButton: 'Audio tracks',
playbackRateMenuButton: 'Playback speed', playbackRateMenuButton: 'Playback speed',
@ -60,6 +62,12 @@ const enableStandardButtonTooltips = (player) => {
? buttonTooltips[buttonName]() ? buttonTooltips[buttonName]()
: buttonTooltips[buttonName]; : buttonTooltips[buttonName];
// Skip empty tooltips
if (!tooltipText || tooltipText.trim() === '') {
console.log('Empty tooltip for button:', buttonName, tooltipText);
return;
}
buttonEl.setAttribute('title', tooltipText); buttonEl.setAttribute('title', tooltipText);
buttonEl.setAttribute('aria-label', tooltipText); buttonEl.setAttribute('aria-label', tooltipText);
@ -2061,11 +2069,11 @@ function VideoJSPlayer({ videoId = 'default-video' }) {
descriptionsButton: false, descriptionsButton: false,
// Subtitles (CC) button should be visible // Subtitles (CC) button should be visible
subtitlesButton: hasSubtitles && !isTouchDevice ? true : false, subtitlesButton: false, // hasSubtitles && !isTouchDevice ? true : false,
// Captions button (keep disabled to avoid duplicate with subtitles) // Captions button (keep disabled to avoid duplicate with subtitles)
captionsButton: false, captionsButton: hasSubtitles ? true : false,
subsCapsButton: false, subsCapsButton: hasSubtitles ? true : false,
// Audio track button // Audio track button
audioTrackButton: true, audioTrackButton: true,