- Merge request !3Issue #3252393: Place the autocomplete next to the filter β (Open) created by cgoffin
- π¦πΉAustria drunken monkey Vienna, Austria
Could you please review so I can merge your MR?
- πΊπΈUnited States kyleleber
@drunken monkey,
I am running into a similar need as the original poster, so glad to help out with this one. I've applied the patch from your commit (https://git.drupalcode.org/project/search_api_autocomplete/-/merge_reque...), and there seems to be an issue with the
data-autocomplete-appendTo
attribute that is being added if i'm understanding things correctly. In core's form-element.html.twig (https://api.drupal.org/api/drupal/core%21modules%21system%21templates%21...), the "form-type-{X}" class isn't being added, but js-form-type-{X} is. Presumably, the form-type-{X} class is being added via a base theme such as classy, which not every theme would declare as a base theme. I was able to at least test things and confirm things looked good on my end by changing$element['#attributes']['data-autocomplete-appendTo'] = ".form-type-search-api-autocomplete:has(.{$class})";
to
$element['#attributes']['data-autocomplete-appendTo'] = ".js-form-type-search-api-autocomplete:has(.{$class})";
Again, I am not entirely sure if we could rely on the ".js-form-type-{X}" selector depending if folks would have overridden that template. However, I think if we could change the class to something at the core template level, rather than as a core theme level, it could help generalize things.
Let me know what you think or if you see any issues with that approach!
- π¦πΉAustria drunken monkey Vienna, Austria
@kjl16: Not really sure what you mean, I donβt see any
data-autocomplete-appendTo
attribute, for example.
Iβll just let you themers figure out the best way forward amongst you and will then probably just commit the result. - π§πͺBelgium cgoffin
@kjl16 @drunken monkey we can also remove the data-autocomplete-appendTo attribute and append it to the parent with the jQuery .parent() selector. Does that sound like a good solution?
uiAutocomplete.element.autocomplete( "option", "appendTo", uiAutocomplete.element.parent());
instead of
uiAutocomplete.element.autocomplete( "option", "appendTo", uiAutocomplete.element.attr('data-autocomplete-appendTo'));
in search_api_autocomplete.js
- Open on Drupal.org βCore: 9.5.x + Environment: PHP 8.1 & sqlite-3.27last update
about 1 year ago Not currently mergeable. - last update
about 1 year ago 34 pass - π³π±Netherlands Tom Grootjans Hoofddorp, The Netherlands
tom grootjans β made their first commit to this issueβs fork.
- π³π±Netherlands Tom Grootjans Hoofddorp, The Netherlands
Here is a new patch against v1.9.0