Use search form element instead of text

Created on 22 June 2023, over 1 year ago
Updated 24 September 2023, about 1 year ago

Problem/Motivation

When using a form element of type search_api_autocomplete it would be great to switch to an input[type="search"] so people can easily clear the search bar.

Steps to reproduce

Create a custom form and add an autocomplete form item like this:

$form['q'] = [
  '#type' => 'search_api_autocomplete',
  '#search_id' => 'content',
];

Proposed resolution

Instead of extending Drupal\Core\Render\Element\Textfield we could simply extend Drupal\Core\Render\Element\Search

User interface changes

A clear button appears next to the AJAX throbber.

API changes

None

Data model changes

None

✨ Feature request
Status

Needs review

Version

1.0

Component

User interface

Created by

🇩🇪Germany yannickoo Berlin

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

Comments & Activities

Production build 0.71.5 2024