Skip to content

Request the numeric keyboard for digits-only postcode formats#101

Open
boo-code wants to merge 1 commit into
PrestaShop:mainfrom
boo-code:feat/numeric-postcode-keyboard
Open

Request the numeric keyboard for digits-only postcode formats#101
boo-code wants to merge 1 commit into
PrestaShop:mainfrom
boo-code:feat/numeric-postcode-keyboard

Conversation

@boo-code

@boo-code boo-code commented Jul 5, 2026

Copy link
Copy Markdown
Contributor
Questions Answers
Description? The postcode input renders with the default keyboard on touch devices even for countries whose zip format only allows digits (core format tokens: N = digit, L = letter, C = iso code — France, Germany, the US, Italy, Spain and most others are pure NNNNN), forcing a keyboard switch on every checkout. Keyboard optimization is one of the standard mobile checkout items (https://baymard.com/blog/mobile-checkout — 60% of top mobile sites fail at least 2 of 5 keyboard optimizations; the module already uses type="email" and type="tel"). This sets inputmode="numeric" on the postcode FormField via setAttr() when the country's zip_code_format matches ^N+$; formats with letters or separators keep the default keyboard, since the numeric layout could not type them. Rendering happens through the theme's form fields partial via the paired PrestaShop/hummingbird#1063 (core already exports FormField::attr in toArray() and runs the additionalHtmlAttributesFormFields hook, but the partial never rendered the slot); with an older theme the attribute is simply not rendered and the behavior stays as today.
Type? improvement
BC breaks? no
Deprecations? no
Fixed ticket?
How to test? vendor/bin/phpunit -c tests/php/phpunit.xml --filter AddressFieldsFormatTraitTest — asserts ['inputmode' => 'numeric'] for a NNNNN country and an empty attr map for a lettered (LN NL) and an empty format. With PrestaShop/hummingbird#1063 applied on a 9.2 shop, all four checkout postcode inputs (inline and modal, delivery and invoice) render inputmode="numeric" for France — verified live; a touch device opens the digit keyboard on the field.

@ps-jarvis

Copy link
Copy Markdown
Collaborator

Hello @boo-code!

This is your first pull request on ps_onepagecheckout repository of the PrestaShop project.

Thank you, and welcome to this Open Source community!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Ready for review

Development

Successfully merging this pull request may close these issues.

2 participants