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(Select): clear button appears with any typeahead input #3502

Merged
merged 2 commits into from
Jan 20, 2020

Conversation

nicolethoen
Copy link
Contributor

Addresses #3460

@patternfly-build
Copy link
Contributor

PatternFly-React preview: https://patternfly-react-pr-3502.surge.sh

@karelhala
Copy link
Contributor

Codewise it looks really good and simple! Can we also call onSelect with the emtpy input so if consumers are using custom filtering they get notified and can filter based on their decision. This is important so when user clears out the text for instance server can be called and queried for all the data instead of filtered ones.

@nicolethoen
Copy link
Contributor Author

nicolethoen commented Jan 15, 2020

Codewise it looks really good and simple! Can we also call onSelect with the emtpy input so if consumers are using custom filtering they get notified and can filter based on their decision. This is important so when user clears out the text for instance server can be called and queried for all the data instead of filtered ones.

@karelhala I could do that. Might it be a breaking change if consumers have written onSelect functions without designing them to handle empty inputs? We do provide an onClear property that is only called when the user clicks the clear button. Can that not serve the same purpose?

@kmcfaul
Copy link
Contributor

kmcfaul commented Jan 16, 2020

onClear will be called already when the clear button is clicked, and this will clear the filtering by default. If you want to prompt an onSelect call, you would be able to do so from the application-side of the code by calling the function passed into onSelect inside the function passed into onClear.

@nicolethoen It does look like there's an issue with the clear button not resetting the filtering when cleared in this way. When the menu is reopened it retains the previous filtered state until new input is entered.
Edit: specifically with the custom filtering example. It works as intended in the other examples

@codecov-io
Copy link

Codecov Report

Merging #3502 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #3502   +/-   ##
=======================================
  Coverage   67.09%   67.09%           
=======================================
  Files         903      903           
  Lines       25482    25482           
  Branches     2257     2257           
=======================================
  Hits        17097    17097           
  Misses       7343     7343           
  Partials     1042     1042
Flag Coverage Δ
#misc 95.45% <ø> (ø) ⬆️
#patternfly3 69.29% <ø> (ø) ⬆️
#patternfly4 64.19% <100%> (ø) ⬆️
Impacted Files Coverage Δ
...nfly-4/react-core/src/components/Select/Select.tsx 64.28% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6243103...549da12. Read the comment docs.

Copy link
Contributor

@tlabaj tlabaj left a comment

Choose a reason for hiding this comment

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

LGTM

@tlabaj tlabaj merged commit f506291 into patternfly:master Jan 20, 2020
@nicolethoen nicolethoen deleted the select_clear_button branch February 8, 2023 13:49
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.

7 participants