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.

CommentFileSizeAuthor
#2 field_id.patch742 bytesbjc2265

Comments

jenlampton created an issue. See original summary.

bjc2265’s picture

StatusFileSize
new742 bytes

This patch adds custom ids to search field and submit field (google-cse-query and google-cse-submit respectively).

mark_fullmer’s picture

Status: Active » Reviewed & tested by the community

The 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-submit ID, 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.

mark_fullmer’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.