-
Notifications
You must be signed in to change notification settings - Fork 134
Allow localization of TextField clear button aria-label #3879
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
Changes from all commits
8933894
aa6b6c9
0f2a860
20df278
5754746
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@primer/view-components": minor | ||
| --- | ||
|
|
||
| Allow localization of TextField clear button aria-label |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -13,7 +13,7 @@ | |||||
| <%= builder.text_field(@input.name, **@input.input_arguments) %> | ||||||
| <% end %> | ||||||
| <% if @input.show_clear_button? %> | ||||||
| <button type="button" id="<%= @input.clear_button_id %>" class="FormControl-input-trailingAction" aria-label="Clear" data-action="click:primer-text-field#clearContents"> | ||||||
| <button type="button" id="<%= @input.clear_button_id %>" class="FormControl-input-trailingAction" aria-label="<%= @input.clear_button_label || 'Clear' %>" data-action="click:primer-text-field#clearContents"> | ||||||
|
||||||
| <button type="button" id="<%= @input.clear_button_id %>" class="FormControl-input-trailingAction" aria-label="<%= @input.clear_button_label || 'Clear' %>" data-action="click:primer-text-field#clearContents"> | |
| <button type="button" id="<%= @input.clear_button_id %>" class="FormControl-input-trailingAction" aria-label="<%= @input.clear_button_label.presence || 'Clear' %>" data-action="click:primer-text-field#clearContents"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clear_button_labelis accepted without any normalization/validation. If callers pass an empty string (common with missing i18n keys), the template will render an emptyaria-label. Consider normalizing blank strings to nil (or raising an ArgumentError whenshow_clear_buttonis true and the label is blank) to prevent generating an unlabeled button.