Problem/Motivation
The Google search form uses generic Drupal edit-submit ID attributes, which could conflict with any/all other Drupal forms on the page.
Though Drupal is supposed to be smart enough to append numbers to IDs when multiple forms with the same IDs are on the page, we have found this to be unreliable on modern Drupal sites, due to the multiple individual caches for many elements making up a single page.
The duplicate ID attributes cause sites to fail accessibility checks, so until the cache/ID problem is resolved in core, we can avoid the problem by not using the generic Drupal attributes on form elements.
Proposed resolution
If the Google CSE form used unique identifiers for the search element and submit button, it would make it less likely to cause conflicts.
Remaining tasks
Add ID attributes to form elements.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | field_id.patch | 742 bytes | bjc2265 |
Comments
Comment #2
bjc2265 commentedThis patch adds custom ids to search field and submit field (google-cse-query and google-cse-submit respectively).
Comment #3
mark_fullmerThe patch in #2 makes sense to me, based on the original issue report. Setting this to RTBC.
In the release for this issue, I think we need to call out this change, since it is possible that sites may have CSS styling (or, less likely JS), that targets the
#edit-submitID, and therefore, when updating to this change, the styling would cease to apply. I don't think that means we shouldn't do it, and I can't think of a way for us to provide a fallback; we just need to call it out.Comment #5
mark_fullmer