Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
- Range component: added range-vertical modifier for vertical orientation (DaisyUI 5.6)
- Tooltip component: added alignment modifiers (tooltip-start, tooltip-center, tooltip-end) and tooltip-content sub-component (DaisyUI 5.6)

### Fixed

- Popover tooltips no longer clip arrows that extend beyond the tooltip card.

## [0.1.0] - 2024-08-02

- Initial release
6 changes: 6 additions & 0 deletions docs/spec/system/tooltip_popover_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,15 @@
const arrow = tooltip.querySelector('[data-daisy-tooltip-target~="arrow"]')
const arrowStyle = getComputedStyle(arrow)
const arrowBounds = arrow.getBoundingClientRect()
const tooltipBounds = tooltip.getBoundingClientRect()

return {
stockArrowDisplay: getComputedStyle(host, "::after").display,
tooltipOverflow: getComputedStyle(tooltip).overflow,
width: arrowBounds.width,
height: arrowBounds.height,
arrowBottom: arrowBounds.bottom,
tooltipBottom: tooltipBounds.bottom,
background: arrowStyle.backgroundColor,
tooltipBackground: getComputedStyle(tooltip).backgroundColor,
borders: [
Expand All @@ -56,8 +60,10 @@
JS

expect(arrow.fetch("stockArrowDisplay")).to eq("none")
expect(arrow.fetch("tooltipOverflow")).to eq("visible")
expect(arrow.fetch("width")).to be > 0
expect(arrow.fetch("height")).to be > 0
expect(arrow.fetch("arrowBottom")).to be > arrow.fetch("tooltipBottom")
expect(arrow.fetch("background")).to eq(arrow.fetch("tooltipBackground"))
expect(arrow.fetch("borders")).to all(eq("0px"))

Expand Down
3 changes: 2 additions & 1 deletion lib/daisy_ui/tooltip.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ class Tooltip < Base

PLACEMENTS = %i[top bottom left right].freeze
DEFAULT_STIMULUS_IDENTIFIER = "daisy-tooltip"
POPOVER_STYLE = "position:fixed;inset:auto;margin:0;border:0;opacity:1;transform:none;pointer-events:none;visibility:hidden"
POPOVER_STYLE = "position:fixed;inset:auto;margin:0;border:0;opacity:1;transform:none;overflow:visible;" \
"pointer-events:none;visibility:hidden"
ARROW_STYLE = "position:absolute;width:.625rem;height:.25rem;background:var(--tt-bg);" \
"clip-path:polygon(0 0,100% 0,50% 100%);pointer-events:none"

Expand Down
1 change: 1 addition & 0 deletions spec/lib/daisy_ui/tooltip_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ def popover_component(*modifiers, **options)
expect(output).to include('role="tooltip"')
expect(output).to include('data-daisy-tooltip-target="content"')
expect(output).to include('data-daisy-tooltip-target="arrow"')
expect(output).to include("overflow:visible")
expect(output).to include("Helpful details")
expect(output).not_to include("data-tip")
end
Expand Down
Loading