Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always set :absolute position on Primer::Alpha::Tooltip #1281

Merged
merged 4 commits into from
Aug 5, 2022
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
5 changes: 5 additions & 0 deletions .changeset/honest-vans-fold.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@primer/view-components": patch
---

Always set `:absolute` position on Primer::Alpha::Tooltip
1 change: 1 addition & 0 deletions app/components/primer/alpha/tooltip.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ def initialize(type:, for_id:, text:, direction: DIRECTION_DEFAULT, **system_arg
@system_arguments[:tag] = :"tool-tip"
@system_arguments[:style] = join_style_arguments(@system_arguments[:style], "visibility: hidden")
@system_arguments[:for] = for_id
@system_arguments[:position] = :absolute
@system_arguments[:"data-direction"] = fetch_or_fallback(DIRECTION_OPTIONS, direction, DIRECTION_DEFAULT).to_s
@system_arguments[:"data-type"] = fetch_or_fallback(TYPE_OPTIONS, type, TYPE_FALLBACK).to_s
end
Expand Down
1 change: 1 addition & 0 deletions static/classes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@
- ".p-3"
- ".p-4"
- ".p-5"
- ".position-absolute"
- ".position-relative"
- ".pr-2"
- ".pt-5"
Expand Down
5 changes: 5 additions & 0 deletions test/components/alpha/tooltip_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,9 @@ def test_raises_if_text_is_not_string
render_inline(Primer::Alpha::Tooltip.new(type: :description, for_id: "someButton", text: not_text, visible: false))
end
end

def test_tooltip_is_position_absolute
render_inline(Primer::Alpha::Tooltip.new(type: :description, for_id: "someButton", text: "Tooltip"))
assert_selector("tool-tip.position-absolute", visible: false)
end
end