Skip to content

Commit 536345e

Browse files
authored
Add unique ids on each textarea to fix announcement issues (#3881)
1 parent 5c2982d commit 536345e

2 files changed

Lines changed: 16 additions & 11 deletions

File tree

.changeset/giant-mails-confess.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@primer/view-components": patch
3+
---
4+
5+
Add unique ids on each textarea to fix announcement issues

previews/primer/alpha/text_area_preview.rb

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -50,69 +50,69 @@ def playground(
5050
# @label Default
5151
# @snapshot
5252
def default
53-
render(Primer::Alpha::TextArea.new(name: "my-text-area", label: "Tell me about yourself"))
53+
render(Primer::Alpha::TextArea.new(id: "my-text-area-default", name: "my-text-area-default", label: "Tell me about yourself"))
5454
end
5555

5656
# @!group Options
5757
#
5858
# @label With caption
5959
# @snapshot
6060
def with_caption
61-
render(Primer::Alpha::TextArea.new(caption: "With a caption", name: "my-text-area", label: "Tell me about yourself"))
61+
render(Primer::Alpha::TextArea.new(id: "my-text-area-with-caption", name: "my-text-area-with-caption", caption: "With a caption", label: "Tell me about yourself"))
6262
end
6363

6464
# @label Visually hidden label
6565
# @snapshot
6666
def visually_hide_label
67-
render(Primer::Alpha::TextArea.new(visually_hide_label: true, name: "my-text-area", label: "Tell me about yourself"))
67+
render(Primer::Alpha::TextArea.new(id: "my-text-area-visually-hide-label", name: "my-text-area-visually-hide-label", visually_hide_label: true, label: "Tell me about yourself"))
6868
end
6969

7070
# @label Full width
7171
# @snapshot
7272
def full_width
73-
render(Primer::Alpha::TextArea.new(full_width: true, name: "my-text-area", label: "Tell me about yourself"))
73+
render(Primer::Alpha::TextArea.new(id: "my-text-area-full-width", name: "my-text-area-full-width", full_width: true, label: "Tell me about yourself"))
7474
end
7575

7676
# @label Not full width
7777
# @snapshot
7878
def not_full_width
79-
render(Primer::Alpha::TextArea.new(full_width: false, name: "my-text-area", label: "Tell me about yourself"))
79+
render(Primer::Alpha::TextArea.new(id: "my-text-area-not-full-width", name: "my-text-area-not-full-width", full_width: false, label: "Tell me about yourself"))
8080
end
8181

8282
# @label Disabled
8383
# @snapshot
8484
def disabled
85-
render(Primer::Alpha::TextArea.new(disabled: true, name: "my-text-area", label: "Tell me about yourself"))
85+
render(Primer::Alpha::TextArea.new(id: "my-text-area-disabled", name: "my-text-area-disabled", disabled: true, label: "Tell me about yourself"))
8686
end
8787

8888
# @label Invalid
8989
# @snapshot
9090
def invalid
91-
render(Primer::Alpha::TextArea.new(invalid: true, name: "my-text-area", label: "Tell me about yourself"))
91+
render(Primer::Alpha::TextArea.new(id: "my-text-area-invalid", name: "my-text-area-invalid", invalid: true, label: "Tell me about yourself"))
9292
end
9393

9494
# @label With validation message
9595
# @snapshot
9696
def with_validation_message
97-
render(Primer::Alpha::TextArea.new(validation_message: "An error occurred!", name: "my-text-area", label: "Tell me about yourself"))
97+
render(Primer::Alpha::TextArea.new(id: "my-text-area-with-validation-message", name: "my-text-area-with-validation-message", validation_message: "An error occurred!", label: "Tell me about yourself"))
9898
end
9999

100100
# @label With character limit
101101
# @snapshot interactive
102102
def with_character_limit
103-
render(Primer::Alpha::TextArea.new(character_limit: 10, name: "my-text-area", label: "Tell me about yourself"))
103+
render(Primer::Alpha::TextArea.new(id: "my-text-area-with-character-limit", name: "my-text-area-with-character-limit", character_limit: 10, label: "Tell me about yourself"))
104104
end
105105

106106
# @label With character limit, over limit
107107
# @snapshot interactive
108108
def with_character_limit_over_limit
109-
render(Primer::Alpha::TextArea.new(character_limit: 10, name: "my-text-area", label: "Tell me about yourself", value: "This text is definitely over the limit."))
109+
render(Primer::Alpha::TextArea.new(id: "my-text-area-with-character-limit-over-limit", name: "my-text-area-with-character-limit-over-limit", character_limit: 10, label: "Tell me about yourself", value: "This text is definitely over the limit."))
110110
end
111111

112112
# @label With character limit and caption
113113
# @snapshot
114114
def with_character_limit_and_caption
115-
render(Primer::Alpha::TextArea.new(character_limit: 100, caption: "With a caption.", name: "my-text-area", label: "Tell me about yourself"))
115+
render(Primer::Alpha::TextArea.new(id: "my-text-area-with-character-limit-and-caption", name: "my-text-area-with-character-limit-and-caption", character_limit: 100, caption: "With a caption.", label: "Tell me about yourself"))
116116
end
117117
#
118118
# @!endgroup

0 commit comments

Comments
 (0)