-
Notifications
You must be signed in to change notification settings - Fork 615
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(storefront): BCTHEME-343 No tooltips provided for carousel butto…
…ns (#1934)
- Loading branch information
1 parent
babdd27
commit f6ba692
Showing
12 changed files
with
164 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
const carouselTooltipClass = 'carousel-tooltip'; | ||
const carouselTooltip = `<span class="${carouselTooltipClass}"></span>`; | ||
|
||
const setupTooltipAriaLabel = ($node) => { | ||
const $existedTooltip = $node.find(`.${carouselTooltipClass}`); | ||
|
||
if ($existedTooltip.length) { | ||
$existedTooltip.attr('aria-label', $node.attr('aria-label')); | ||
} else { | ||
const $tooltip = $(carouselTooltip).attr('aria-label', $node.attr('aria-label')); | ||
$node.append($tooltip); | ||
} | ||
}; | ||
|
||
const setupArrowTooltips = (...arrowNodes) => { | ||
arrowNodes.forEach($arrow => setupTooltipAriaLabel($arrow)); | ||
}; | ||
|
||
const setupDotTooltips = ($dots) => { | ||
$dots.children().each((idx, dot) => setupTooltipAriaLabel($(dot).find('button'))); | ||
}; | ||
|
||
export default ($prevArrow, $nextArrow, $dots) => { | ||
if ($prevArrow.length && $nextArrow.length) { | ||
setupArrowTooltips($prevArrow, $nextArrow); | ||
} | ||
if ($dots) { | ||
setupDotTooltips($dots); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
@mixin addFocusTooltip ($attr: title) { | ||
&:before { | ||
content: " "; | ||
position: absolute; | ||
right: 0; | ||
top: 50%; | ||
border-width: remCalc(10px); | ||
border-style: solid; | ||
border-color: transparent transparent $adminBar-tooltip-bg-backgroundColor transparent; | ||
} | ||
|
||
&:after { | ||
content: attr($attr); | ||
padding: remCalc(4px) remCalc(6px); | ||
background-color: $adminBar-tooltip-bg-backgroundColor; | ||
color: white; | ||
position: absolute; | ||
font-size: 1rem; | ||
white-space: nowrap; | ||
right: 0; | ||
top: 100%; | ||
cursor: default; | ||
border-radius: remCalc(8px); | ||
} | ||
|
||
&:before, | ||
&:after { | ||
display: none; | ||
} | ||
|
||
&:focus { | ||
&:before, | ||
&:after { | ||
display: block; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
@import 'aria'; | ||
@import 'focus-tooltip'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters