Skip to content

Commit 8e72b45

Browse files
dflclaude
andcommitted
TEF-1017: add inputmode="numeric" to day and year date inputs
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 0d9c829 commit 8e72b45

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

app/components/memorable_date_component.html.erb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
id: input_id(3),
7474
placeholder: @placeholder_day,
7575
class: "w-12",
76+
inputmode: "numeric",
7677
aria: {invalid: invalid, describedby: described_by_value(help: @helper_text.present?)}.compact
7778
) %>
7879
</div>
@@ -85,6 +86,7 @@
8586
id: input_id(1),
8687
placeholder: @placeholder_year,
8788
class: "w-18",
89+
inputmode: "numeric",
8890
aria: {invalid: invalid, describedby: described_by_value(help: @helper_text.present?)}.compact
8991
) %>
9092
</div>

test/components/memorable_date_component_test.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,13 @@ def test_valid_date_renders_from_the_cast_value
234234
assert_selector "input[name='date_picker_test_model[my_date(2i)]'][value='3']", visible: :all
235235
end
236236

237+
def test_day_and_year_fields_have_numeric_inputmode
238+
render_inline(MemorableDateComponent.new(form: build_form, method: :my_date, label: "Date of birth"))
239+
240+
assert_selector "input#date_picker_test_model_my_date_3i[inputmode='numeric']"
241+
assert_selector "input#date_picker_test_model_my_date_1i[inputmode='numeric']"
242+
end
243+
237244
def test_month_options_render_in_spanish_when_locale_is_es
238245
I18n.with_locale(:es) do
239246
render_inline(MemorableDateComponent.new(

0 commit comments

Comments
 (0)