Allow "search" form element for Views search fields, too

Created on 17 August 2021, almost 4 years ago
Updated 26 July 2025, 4 days ago

As discussed in How to change input type from "text" to "search" Needs work , the correct type for search keywords form fields is probably search, not textfield. However, if Search API would change that, our current Views form alter code, which explicitly checks for the textfield type, would immediately stop working.

In anticipation of this change, we should therefore just accept both types for now – it’s just meant as a safeguard in case the type is something more exotic, but search and textfield are of course functionally pretty much the same.

One harder question, though, is what to do when adding the autocomplete to the form element: As we have defined our own Drupal form element for this, this would currently change the input field’s type back to text, as our form element inherits from Textfield. Changing this to Search might break compatibility in the code for a few, but would also change the form’s HTML even before How to change input type from "text" to "search" Needs work gets committed, with the same problems discussed there. So should probably wait until we have reached a decision there. (But maybe we can still already commit the first part?)

🐛 Bug report
Status

Needs review

Version

1.0

Component

General code

Created by

🇦🇹Austria drunken monkey Vienna, Austria

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024