Skip to content

Commit

Permalink
feat(tooltip): add data-tooltip alias for tooltip attribute (#858)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nantawat-Poothong authored Jul 25, 2023
1 parent efe86d1 commit c0abb54
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/elements/src/tooltip/helpers/renderer.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import type { TooltipRenderer } from './types';

/**
* A default renderer that renders `tooltip` attribute
* A default renderer that renders `tooltip` or `data-tooltip` attributes
* @param target Target to check
* @returns tooltip or null or undefined
*/
const tooltipRenderer: TooltipRenderer = (target: HTMLElement) => {
if (target.hasAttribute('tooltip')) {
return target.getAttribute('tooltip');
if (target.hasAttribute('tooltip') || target.hasAttribute('data-tooltip')) {
return target.getAttribute('tooltip') || target.getAttribute('data-tooltip');
}
};

Expand Down

0 comments on commit c0abb54

Please sign in to comment.