Skip to content

USWDS - Bug: Tooltip documentation claims the tooltip component applies to any element; it only applies to buttons #5190

@brentryanjohnson

Description

@brentryanjohnson

Describe the bug

The tooltip documentation states:

Any element with the class name usa-tooltip and a title attribute will become a tooltip.

This doesn't appear to be correct. The tooltip component appears to only target button elements.

// Initialize tooltip if it hasn't already
      if (elementType === "BUTTON" && trigger.hasAttribute("title")) {
        setUpAttributes(trigger);
      }

Steps to reproduce the bug

  • Attempt to apply tooltip component to any element other than button

Expected Behavior

Based on the documentation, one would expect the tooltip component to apply to "any element with the class name usa-tooltip and a title attribute."

Related code

// Initialize tooltip if it hasn't already
      if (elementType === "BUTTON" && trigger.hasAttribute("title")) {
        setUpAttributes(trigger);
      }

Screenshots

No response

System setup

No response

Additional context

No response

Code of Conduct

Metadata

Metadata

Assignees

Labels

Affects: DocumentationRelates to documentation. Should this be in uswds-site?Needs: ResearchWe need to conduct user research before proceedingPackage: TooltipQ2 researchRole: UXUX skills neededType: SpikeA short research activity to help make a decision

Type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions