Visitar URL original
Add top as default position · uswds/uswds@1c4446b · GitHub
Skip to content

Commit 1c4446b

Browse files
committed
Add top as default position
1 parent 29eebc4 commit 1c4446b

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎packages/usa-tooltip/src/index.js‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ const getTooltipElements = (trigger) => {
2828

2929
/**
3030
* Shows the tooltip
31+
* @param {HTMLElement} tooltipBody - the element that contains the tooltip content
3132
* @param {HTMLElement} tooltipTrigger - the element that initializes the tooltip
33+
* @param {String} position - the string passed from data-position on the trigger
3234
*/
3335
const showToolTip = (tooltipBody, tooltipTrigger, position) => {
3436
tooltipBody.setAttribute("aria-hidden", "false");
@@ -317,7 +319,7 @@ const setUpAttributes = (tooltipTrigger) => {
317319
const tooltipBody = document.createElement("span");
318320
const position = tooltipTrigger.getAttribute("data-position")
319321
? tooltipTrigger.getAttribute("data-position")
320-
: "top";
322+
: tooltipTrigger.setAttribute("data-position", "top");
321323
const additionalClasses = tooltipTrigger.getAttribute("data-classes");
322324

323325
// Set up tooltip attributes

0 commit comments

Comments
 (0)