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

Allow disabling submit buttons #2188

Merged
merged 2 commits into from
Aug 2, 2023
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
7 changes: 7 additions & 0 deletions .changeset/eighty-carrots-protect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@primer/view-components': minor
---

Allow disabling submit buttons

<!-- Changed components: Primer::Alpha::FormButton, Primer::Alpha::SubmitButton -->
4 changes: 0 additions & 4 deletions lib/primer/forms/button.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ def initialize(input:, type: :button)

# rails uses a string for this, but PVC wants a symbol
@input.merge_input_arguments!(type: type.to_sym)

# Never allow buttons to be disabled. Disabling buttons is not accessible.
# See: https://primer.style/design/ui-patterns/saving#state
@input.input_arguments.delete(:disabled)
end

def input_arguments
Expand Down
7 changes: 0 additions & 7 deletions test/lib/primer/forms_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,6 @@ def test_renders_buttons_with_slots
end
end

def test_disallows_disabled_buttons
render_preview :submit_button_form

button = page.find_all("button[type=submit]").first
assert_nil button["disabled"]
end

def test_renders_buttons_with_primer_utility_margins
render_preview :submit_button_form

Expand Down
Loading