Skip to content
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

[HxSearch] the search icon isn't clickable #752

Open
blanchardglen opened this issue Feb 11, 2024 · 4 comments
Open

[HxSearch] the search icon isn't clickable #752

blanchardglen opened this issue Feb 11, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@blanchardglen
Copy link
Contributor

Loving using Havit :)

We are using HxSearch as a fancy select/option box with a Chevron down icon to make it visually appear to be one.
image

But clicking/tapping on the chevron doesn't trigger the dropdown like it does when clicking on the rest of the component.

else if (SearchIconEffective is not null)
{
<div class="hx-search-box-input-icon hx-search-box-input-icon-end">
<HxIcon Icon="SearchIconEffective" />
</div>
}

Perhaps a click on the search icon could trigger HandleInputFocus or wrapping the search icon in a <label for="@_inputId">...</label>

Would a PR for this be accepted and which method would be preferred if they both work?

Side note: As a workaround I could remove the chevron but that is harder than it appears to be, setting it to null and the defaults which can't be nulled take over, the best I could do was to replace it with a transparent icon.

@hakenr
Copy link
Member

hakenr commented Feb 13, 2024

We are using HxSearch as a fancy select/option box with a Chevron down icon to make it visually appear to be one.

Please note that HxSearchBox lacks the complete functionality of HxInputBase, e.g., it doesn't support validation.

I agree we should find a way to handle clicks on the SearchIcon.

But clicking/tapping on the chevron doesn't trigger the dropdown, unlike when you click on the rest of the component.

I understand your scenario, but clicking the component doesn't always open the dropdown. There are numerous scenarios where clicking the input behaves differently.

We could consider forwarding the click event from the icon to the click event of the input, but I'm undecided if clicking the "magnifier" icon—especially when there's text entered in the input—shouldn't be interpreted as initiating a search (submit/Enter)?

@crdo?

(If we reach a consensus on the desired behavior, I'd be more than happy to encourage you to contribute by submitting a PR for it. ;-))

@hakenr hakenr added the enhancement New feature or request label Feb 13, 2024
@hakenr hakenr added this to the Priority 3 - Low milestone Feb 13, 2024
@crdo
Copy link
Member

crdo commented Mar 27, 2024

@blanchardglen until we agree on some solution, there is an easy work-around for this.

You can set pointer-events: none; on .hx-search-box-input-icon so the click on the icon wrapper propagates to the underlying input.

@blanchardglen
Copy link
Contributor Author

You can set pointer-events: none; on .hx-search-box-input-icon so the click on the icon wrapper propagates to the underlying input.

That works a treat, thank you. I can still do a PR for this when a decision is made but that solves my immediate need.

@hakenr
Copy link
Member

hakenr commented Apr 9, 2024

@blanchardglen, do you have any alternative suggestions for the proposed PR aside from pointer-events: none;? I currently don't see it as the ideal solution, since we've encountered some issues related to pointer-events before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants