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

fix(sffv): disable sffv input when few facet values FIX #2111 #2120

Merged
merged 4 commits into from
Apr 20, 2017

Conversation

bobylito
Copy link
Contributor

@bobylito bobylito commented Apr 20, 2017

When the number of items displayed in a refinement list is lower than
the max number of facet displayed, the search for facet input should be
disabled.

This fix disables the input and adds a new classname to identify the
state of the input.

Result

staging default: the search input is not disabled.

fixes #2111

staging with a query that limits the items: the input is disabled.

When the number of items displayed in a refinement list is lower than
the max number of facet displayed, the search for facet input should be
disabled.

This fix disable the input and adds a new classname to identify the
state of the input.
@@ -42,7 +46,7 @@ export default class SearchBox extends React.Component {
</svg>

<div role="search" className="sbx-sffv__wrapper">
<input type="search" name="search" placeholder={placeholder} autoComplete="off" required="required" className="sbx-sffv__input" onChange={e => onChange(e.target.value)} ref={i => { this.input = i; }} />
{searchInput}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about {...this.props.disabled} /> instead of passing two different items

@algobot
Copy link
Contributor

algobot commented Apr 20, 2017

Deploy preview ready!

Built with commit 2757305

https://deploy-preview-2120--algolia-instantsearch.netlify.com

@algobot
Copy link
Contributor

algobot commented Apr 20, 2017

Deploy preview ready!

Built with commit a41c7c6

https://deploy-preview-2120--algolia-instantsearch.netlify.com

@@ -164,7 +164,8 @@ class RefinementList extends React.Component {
<SearchBox ref={i => { this.searchbox = i; }}
placeholder={this.props.searchPlaceholder}
onChange={this.props.searchFacetValues}
onValidate={() => this.refineFirstValue()}/> :
onValidate={() => this.refineFirstValue()}
disabled={displayedFacetValues.length < limit}/> :
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this disables it as well when you're searching

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch 👍

@bobylito
Copy link
Contributor Author

Should be good @Haroenv

Copy link
Contributor

@Haroenv Haroenv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this works well 😄

@bobylito bobylito merged commit 1e33c10 into develop Apr 20, 2017
@bobylito bobylito deleted the fix/2111 branch April 20, 2017 14:45
@gabriel-kaam
Copy link

gabriel-kaam commented May 18, 2017

Hi @bobylito ( cc @Haroenv ; @seafoox ),

I'm having an issue with my SearchBox , this PR may be the cause.

See on my website : https://www.shopsquare.fr/mode/femme/bomber .

We have numerous filters with SearchBox on this page, but since this this fix has been deployed ; none of the SearchBox seems to be working.

See how all our filters' SearchBox (couleurs, marques ...) are disabled when they should not ? My end-users are actually crying :(

Why are the inputs disabled ?

Because, even if we limit the results to 100 items , we still use an css overflow rule so the user is able to see all results by scrolling, while only displaying less items on the page at the same time .

capture d ecran 2017-05-18 a 15 36 50

capture d ecran 2017-05-18 a 15 25 14

Here we are limiting the request to fetch a maximum of 100 results in our code, so even if we only display ~8 to the user at the same time ; we still provide a way to scroll thru the entire set (css overflow).

So even if this feature can be useful in some case, I think it should be easily disabled by config. And if you want my full opinion, I do not think it should be the default behaviour. A visible, but disabled input is always a bad experience for the user, IMO.

Right now I going to have use a previous or modified version of the library ( without this fix ) on our website, which is not ideal. Could you provide me with a way to recover the initial behaviour so we at Shopsquare can sync with the CDN version ?

Cheers :)

ping @julienpa

@Haroenv
Copy link
Contributor

Haroenv commented May 18, 2017

Hey @gabriel-kaam, this should not cause your inputs to be disabled, we will look into how to support both the use case and the use case this pull request fixed.

For now the only solution is to use an older version or a custom version of the library.

Thanks for opening the discussion

@Haroenv
Copy link
Contributor

Haroenv commented May 18, 2017

I’d love to be able to replicate how you load the extra facets, could you leave more info in #2156 @gabriel-kaam?

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

Successfully merging this pull request may close these issues.

When the number of facet values retrieved is less than the number to display, IS should hide the search input
5 participants