Skip to content

feat: add HTML tooltip component - #40

Merged
luwes merged 2 commits into
mainfrom
html-tooltip
Oct 7, 2025
Merged

feat: add HTML tooltip component#40
luwes merged 2 commits into
mainfrom
html-tooltip

Conversation

@luwes

@luwes luwes commented Oct 7, 2025

Copy link
Copy Markdown
Collaborator

This pull request introduces a new tooltip component to the HTML package and refactors how popover and tooltip portals are handled in both the HTML and React packages. The changes enable more flexible, portal-based positioning for overlays like tooltips and popovers, and add a robust tooltip experience to the default media skin.

New Tooltip Component and Portal Refactor:

  • Added a fully-featured media-tooltip web component suite, including root, trigger, portal, positioner, popup, and arrow elements, with support for floating positioning and accessibility features.
  • Integrated the tooltip component into the default media skin, providing tooltips for play/pause and fullscreen buttons, and added corresponding styles. [1] [2] [3]

Portal Handling Improvements:

  • Introduced a reusable uniqueId utility for generating unique element IDs, used to link portals to their containers.
  • Refactored media-popover components to use a dedicated media-popover-portal element for rendering overlays into a specific container, improving layering and positioning. [1] [2] [3] [4] [5] [6]

React Component Consistency:

  • Aligned the React PopoverPortal and TooltipPortal props to use root and rootId instead of container and id, matching the HTML component API for portal targeting. [1] [2] [3] [4]

Other Notable Changes:

  • Removed hardcoded z-index from media-popover-positioner in favor of portal-based stacking.

These changes collectively improve overlay component flexibility, accessibility, and maintainability across both HTML and React implementations.

@luwes
luwes requested a review from Copilot October 7, 2025 20:33
@luwes luwes self-assigned this Oct 7, 2025
@vercel

vercel Bot commented Oct 7, 2025

Copy link
Copy Markdown

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

Project Deployment Preview Comments Updated (UTC)
vjs-10-demo-html Ready Ready Preview Comment Oct 7, 2025 9:13pm
vjs-10-demo-react Ready Ready Preview Comment Oct 7, 2025 9:13pm

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds a comprehensive HTML tooltip component to the media player, standardizing the Portal API across both Tooltip and Popover components.

  • Implements a new HTML tooltip component with floating UI positioning and accessibility features
  • Updates React components to use consistent Portal API with rootId instead of id props
  • Adds tooltip functionality to play/pause and fullscreen buttons in the HTML media skin

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/react/react/src/skins/default/styles.ts Removes media-container class from styles
packages/react/react/src/skins/default/MediaSkinDefault.tsx Updates Portal components to use rootId prop
packages/react/react/src/components/Tooltip.tsx Changes Portal API from container/id to root/rootId
packages/react/react/src/components/Popover.tsx Updates Portal API to match Tooltip component
packages/html/html/src/utils/element-utils.ts Adds unique ID generator utility function
packages/html/html/src/skins/media-skin-default.ts Integrates tooltip components into media player template
packages/html/html/src/components/media-tooltip.ts Implements complete HTML tooltip component with floating UI
packages/html/html/src/components/media-popover.ts Adds Portal component and updates positioning

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

computePosition(trigger, popup, {
placement,
middleware,
}).then(({ x, y, middlewareData }: { x: number; y: number; middlewareData: any }) => {

Copilot AI Oct 7, 2025

Copy link

Choose a reason for hiding this comment

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

The middlewareData parameter should have a more specific type instead of any. Consider defining an interface or using the proper type from @floating-ui/dom.

Copilot uses AI. Check for mistakes.

const triggerElement = this.firstElementChild as HTMLElement;
if (triggerElement) {
triggerElement.setAttribute('aria-describedby', 'tooltip');

Copilot AI Oct 7, 2025

Copy link

Choose a reason for hiding this comment

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

The aria-describedby value should reference a unique ID rather than the generic string 'tooltip'. Consider using uniqueId() to generate a proper reference.

Copilot uses AI. Check for mistakes.
@vercel
vercel Bot temporarily deployed to Preview – vjs-10-demo-react October 7, 2025 21:12 Inactive
@vercel
vercel Bot temporarily deployed to Preview – vjs-10-demo-html October 7, 2025 21:13 Inactive
@luwes
luwes merged commit d2a0b27 into main Oct 7, 2025
3 checks passed
@luwes
luwes deleted the html-tooltip branch October 7, 2025 21:22
@github-actions github-actions Bot mentioned this pull request Oct 24, 2025
@github-actions github-actions Bot mentioned this pull request Feb 26, 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