Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Add the autocapitalize attribute to given, additional, and family name properties, as defined here:
https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autocapitalize
This functionality assists users entering names using virtual keyboards on mobile devices or voice input.
Comment | File | Size | Author |
---|---|---|---|
#6 | interdiff-3021296-2-6.txt | 946 bytes | lisastreeter |
#6 | address-autocapitalize-3021296-6.patch | 459 bytes | lisastreeter |
|
Comments
Comment #2
lisastreeter CreditAttribution: lisastreeter at Centarro commentedSimple patch to add autocapitalize attribute.
Comment #3
bojanz CreditAttribution: bojanz at Centarro commentedAny reason not to do this for all fields?
Comment #4
lisastreeter CreditAttribution: lisastreeter at Centarro commentedI can't think of any reason not to do this on all fields. However...
I'm having trouble verifying that this actually works at all. I can inspect the elements to see that the attribute has been correctly added. On my iPhone, I was initially seeing all fields get automatically capitalized (Safari browser). I found the setting to turn that functionality off. But now nothing is autocapitalizing. The attribute is being ignored for the name fields. I don't know whether this is just an iPhone thing. Perhaps iPhone just uses its own setting and ignores the attribute. I couldn't find any information on this, but I will try to investigate further.
Comment #5
mglamanWe could do it to all of the fields. In reality, it only makes sense on the name fields -- maybe line1 and line2? But, it is a global attribute so it isn't invalid to just always add it. Doesn't hurt and removes logic.
As for testing: people can disable the setting, or browser support might be mixed. For example, disabling autocorrect is a hit or miss attribute.
Comment #6
lisastreeter CreditAttribution: lisastreeter at Centarro commentedI've added the attribute to all fields.
Comment #7
lisastreeter CreditAttribution: lisastreeter at Centarro commentedComment #8
bojanz CreditAttribution: bojanz at Centarro commentedLooks like it's only supported on iOS: https://caniuse.com/#feat=mdn-html_elements_form_autocapitalize
Comment #9
mglamanBased on this: https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/auto..., it is part of the spec and supported by most mobile browsers. I wonder why there is a disparity between caniuse.
But, it is in the living standard (aka HTML5): https://html.spec.whatwg.org/multipage/interaction.html#autocapitalization
Comment #11
mglamanCommitted! This has been on a production site for quite a while.