-
Notifications
You must be signed in to change notification settings - Fork 516
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SearchBox Widget: Template options are janky/broken #2528
Comments
Thanks for this bug report @timkelty 👍 |
I've been able to reproduce what you describe. We'll be able to fix the bug that prevent you from usage a custom reset button and add some css classes. However we won't be able to change the structure nor make span divs, even though that's an error on our hand when adding the new searchbox in v2. |
Thanks @bobylito, will you queue up those breaking changes for v3 then? |
I'm wondering how much of these changes are really important, here. These are the changes I'm thinking about:
|
Yeah, this doesn't really matter much at all.
Would this make my above Attempt 1 and Attempt 2 both work? The most troubling bug was my "Attempt 3", where it just threw an error when to change the reset template. Do any of your changes address this? |
Indeed. There is an open PR for that #2585
Yes. It would have removed the friction. The root class is used inside a template, which gets removed when using a custom template. |
* chore(dev-novel): demonstrate bug with searchbox templates * chore(scripts): add npm command to launch dev-novel only * chore: adds doc for functions used in searchbox * chore(searchbox): adds classnames to magnifier and rese * fix(searchbox): fix usage of custom reset template fix #2528 * chore: fix test, was based on template content not fixed DOM
Do you want to request a feature or report a bug?
bug
What is the version you are using? Always use the latest one before opening a bug issue.
2.2.1 (latest as of post)
All I want to do is override the default
magnifier
andreset
templates (use a different SVG).There seem to be a number of oddities. First off, the options seems structured differently than most other core widgets. Instead of having a root level
templates
, andcssClasses
props, it instead has root props ofmagnifier
andreset
. Nothing inherently broken there, just seems inconsistent (at least with the widgets I'm familiar with).Second, the
cssClasses
prop doesn't really seem to work.Attempt 1:
Try and render a custom template for the magnifier
It rendered my svg! However, within an empty span…I was expecting it to still be wrapped by an element with an
.ais-search-box--magnifier
since, I didn't overridecssClasses
.Oh well, Attempt 2:
Try and manually add the class?
Bubkis. Same result as Attempt 1.
Attempt 3:
Try and render a custom template for the reset button
Error!
Then I post this and gave up. :)
The text was updated successfully, but these errors were encountered: