Skip to content

Commit 3f8b73c

Browse files
bsatarnejadmyabc
andauthored
[60904] Accessibility for new datepicker (opf#18492)
* add aria live region for inputs * add aria live region for finish date * change the way we use aria-live * add test to check if there is aria live set for datepickr inputs * fix line too long issue * Update spec/components/work_packages/date_picker/dialog_content_component_spec.rb Co-authored-by: Alexander Brandon Coles <a.coles@openproject.com> --------- Co-authored-by: Alexander Brandon Coles <a.coles@openproject.com>
1 parent 32911b8 commit 3f8b73c

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

app/components/work_packages/date_picker/date_form_component.html.erb

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
end
1919

2020
start_date.with_row(classes: "wp-datepicker-dialog-date-form--text-field-container") do
21-
render(Primer::Alpha::TextField.new(**text_field_options(name: :start_date, label: start_date_label)))
21+
render(Primer::Alpha::TextField.new(**text_field_options(name: :start_date, label: start_date_label), aria: { live: :polite }))
2222
end
2323
start_date.with_row(classes: "wp-datepicker-dialog-set-today-link") do
2424
render_today_link(name: :start_date)
@@ -45,7 +45,7 @@
4545
end
4646

4747
due_date.with_row(classes: "wp-datepicker-dialog-date-form--text-field-container") do
48-
render(Primer::Alpha::TextField.new(**text_field_options(name: :due_date, label: I18n.t("attributes.due_date"))))
48+
render(Primer::Alpha::TextField.new(**text_field_options(name: :due_date, label: I18n.t("attributes.due_date")), aria: { live: :polite }))
4949
end
5050
due_date.with_row(classes: "wp-datepicker-dialog-set-today-link") do
5151
render_today_link(name: :due_date)
@@ -54,7 +54,7 @@
5454
end
5555

5656
body.with_column(classes: "wp-datepicker-dialog-date-form--duration") do
57-
render(Primer::Alpha::TextField.new(**text_field_options(name: :duration, label: WorkPackage.human_attribute_name("duration"))))
57+
render(Primer::Alpha::TextField.new(**text_field_options(name: :duration, label: WorkPackage.human_attribute_name("duration")), aria: { live: :polite }))
5858
end
5959
end
6060
end

spec/components/work_packages/date_picker/dialog_content_component_spec.rb

+3-2
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,9 @@
5050
let(:schedule_manually) { true }
5151

5252
it "shows the date form" do
53-
expect(dialog_content).to have_field(I18n.t("attributes.start_date"))
54-
expect(dialog_content).to have_field(I18n.t("attributes.due_date"))
53+
expect(dialog_content).to have_field(I18n.t("attributes.start_date"), aria: { live: :polite })
54+
expect(dialog_content).to have_field(I18n.t("attributes.due_date"), aria: { live: :polite })
55+
expect(dialog_content).to have_field(WorkPackage.human_attribute_name("duration"), aria: { live: :polite })
5556
end
5657

5758
it "has an enabled save button" do

0 commit comments

Comments
 (0)