Skip to content

feat: update html tooltip API / use command attr#151

Merged
luwes merged 1 commit intomainfrom
new-html-tooltip-api
Oct 31, 2025
Merged

feat: update html tooltip API / use command attr#151
luwes merged 1 commit intomainfrom
new-html-tooltip-api

Conversation

@luwes
Copy link
Copy Markdown
Collaborator

@luwes luwes commented Oct 31, 2025

This pull request refactors the tooltip and popover components in the HTML media player examples and supporting code, simplifying their structure and improving accessibility and maintainability. The most significant changes include consolidating the tooltip implementation, updating the way tooltips and popovers are triggered, and streamlining the CSS selectors and styles.

Component Structure and Triggering

  • Refactored tooltip markup in index.html files (examples/html-eject-frosted/index.html, examples/html-eject-minimal/index.html) to use a single media-tooltip element with direct attributes for configuration, replacing the previous complex nested structure (media-tooltip-trigger, media-tooltip-portal, etc.). Tooltip and popover triggers now use the commandfor attribute instead of popovertarget, and popovers use popover="manual" for explicit control. [1] [2] [3] [4]

  • Updated the popover and tooltip JavaScript classes to use the new commandfor attribute for trigger association and simplified custom element definitions to only require media-tooltip. [1] [2]

Tooltip and Popover Styling

  • Changed CSS selectors and styles in both frosted and minimal themes to style media-tooltip directly instead of media-tooltip-popup, and updated selectors for showing/hiding tooltip text based on media state. [1] [2] [3] [4] [5]

Tooltip Functionality and Accessibility

  • Refactored the tooltip element implementation in TypeScript to consolidate logic into a single TooltipElement class, add accessibility roles, support new attributes (side, side-offset, collision-padding), and use AbortController for event listener cleanup. [1] [2]

Component API Consistency

  • Updated the volume slider indicator element in both HTML examples to use media-volume-slider-indicator instead of media-volume-slider-progress for consistency with the component API. [1] [2]

Popover Lifecycle Management

  • Improved popover lifecycle management by ensuring cleanup functions are called when popovers are closed, preventing memory leaks.

This refactor streamlines the tooltip and popover implementation, making the codebase easier to maintain and improving the accessibility and configurability of media controls.

@luwes luwes requested a review from Copilot October 31, 2025 19:43
@luwes luwes self-assigned this Oct 31, 2025
@vercel
Copy link
Copy Markdown

vercel bot commented Oct 31, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
vjs-10-demo-react Ready Ready Preview Comment Oct 31, 2025 7:43pm
vjs-10-website Ready Ready Preview Comment Oct 31, 2025 7:43pm

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request refactors the tooltip and popover components to simplify their API and improve maintainability. The changes consolidate the multi-element tooltip structure into a single media-tooltip element and update trigger associations to use the commandfor attribute instead of popovertarget.

  • Consolidated tooltip markup from multiple nested elements to a single media-tooltip element with direct attributes
  • Updated trigger mechanism to use commandfor instead of popovertarget for better semantic consistency
  • Simplified CSS selectors to target media-tooltip directly and improved state-based styling approach

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.

Show a summary per file
File Description
site/src/utils/ejectCodeGenerator.ts Updates HTML generation to use simplified tooltip structure and new commandfor attribute
packages/html/src/skins/minimal/styles.css Changes CSS selectors from media-tooltip-popup to media-tooltip and updates state selectors
packages/html/src/skins/minimal/index.ts Updates template to use consolidated tooltip markup structure
packages/html/src/skins/frosted/styles.css Changes CSS selectors from media-tooltip-popup to media-tooltip and updates state selectors
packages/html/src/skins/frosted/index.ts Updates template to use consolidated tooltip markup structure
packages/html/src/elements/tooltip.ts Major refactor consolidating multiple tooltip classes into single TooltipElement class
packages/html/src/elements/popover.ts Updates trigger selector and adds cleanup logic for memory management
packages/html/src/define/media-tooltip.ts Simplifies custom element definitions to only register media-tooltip
examples/html-eject-minimal/src/minimal.css Updates CSS selectors for simplified tooltip structure
examples/html-eject-minimal/index.html Updates HTML markup to use new consolidated tooltip structure
examples/html-eject-frosted/src/frosted.css Updates CSS selectors for simplified tooltip structure
examples/html-eject-frosted/index.html Updates HTML markup to use new consolidated tooltip structure

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@luwes luwes merged commit 1e7c8ae into main Oct 31, 2025
6 checks passed
@luwes luwes deleted the new-html-tooltip-api branch October 31, 2025 19:50
@github-actions github-actions bot mentioned this pull request Oct 31, 2025
@github-actions github-actions bot mentioned this pull request Feb 26, 2026
@github-actions github-actions bot mentioned this pull request Mar 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants