Skip to content

Commit

Permalink
Fix disabled state for link (#4190)
Browse files Browse the repository at this point in the history
Ruwnay https://runway.powerhrg.com/backlog_items/PLAY-1862

When using the link variant for our button kit, it is not properly
applying the disabled prop.

When disabled it is forced to use the button tag

Maddie had the issue and reported it in the playbook room
  • Loading branch information
markdoeswork authored Jan 30, 2025
1 parent e43cf01 commit 0719f7c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion playbook/app/pb_kits/playbook/pb_button/button.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def link_options
end

def tag
link ? "a" : "button"
link && !disabled ? "a" : "button"
end

def valid_emoji(icon)
Expand Down
3 changes: 3 additions & 0 deletions playbook/spec/pb_kits/playbook/kits/button_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
it "returns 'a' when link is provided" do
expect(subject.new(link: true).tag).to eq "a"
end
it "returns 'button' when link and disabled" do
expect(subject.new(link: true, disabled: true).tag).to eq "button"
end
end

describe "#link_options" do
Expand Down

0 comments on commit 0719f7c

Please # to comment.