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

Spaces are not accepted in p-dropdown filters #3657

Closed
bgsavage opened this issue Aug 14, 2017 · 4 comments
Closed

Spaces are not accepted in p-dropdown filters #3657

bgsavage opened this issue Aug 14, 2017 · 4 comments
Assignees
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@bgsavage
Copy link

bgsavage commented Aug 14, 2017

I'm submitting a ... (check one with "x")

[ X] bug report => Search github for a similar issue or PR before submitting
[ ] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primeng/wiki/Roadmap
[ ] support request => Please do not submit support request here, instead see http://forum.primefaces.org/viewforum.php?f=35

Plunkr Case (Bug Reports)

http://plnkr.co/edit/K1yVZnIGBmmTAe70934c?p=preview

Current behavior
In v4.1.3 spaces are not allowed in the dropdown filter

Expected behavior
Spaces should be allowed in the dropdown filters as they were in v4.1.2

Minimal reproduction of the problem with instructions

  1. Open a dropdown with a filter
  2. Try typing a space in the filter (for example: "race car".

Expected: "race car" should be an allowable search term.
Actual: Spaces are not allowed.

Please tell us about your environment:
MacOSX on Chrome

  • Angular version: 2.0.X
    4.2.6

  • PrimeNG version: 2.0.X
    4.1.3

  • Browser:
    Chrome

@bgsavage bgsavage changed the title Spaces are not accepted in p-dropdown filters [BUG] Spaces are not accepted in p-dropdown filters Aug 15, 2017
@DustinEwers
Copy link
Contributor

DustinEwers commented Aug 16, 2017

Looks like that's happening because the space key opens up the dropdown menu.

My guess at the proper behavior would be to check to see if the dropdown is already open before blocking the space key.

Here's the code:
image

@DustinEwers
Copy link
Contributor

DustinEwers commented Aug 16, 2017

Here's my suggested fix. If no one grabs this I'll put in a proper pull request later tonight or tomorrow night.

On this file: https://github.com/primefaces/primeng/blob/master/src/app/components/dropdown/dropdown.ts

change this (line 465):

        //space
        case 32:
            this.show();
            event.preventDefault();
        break;

to this:

        //space
        case 32:
            if(!this.panelVisible){
                this.show();
                event.preventDefault();
            }
        break;

@bgsavage
Copy link
Author

Looks promising.

DustinEwers added a commit to DustinEwers/primeng that referenced this issue Aug 20, 2017
cagataycivici added a commit that referenced this issue Aug 22, 2017
@cagataycivici cagataycivici self-assigned this Aug 22, 2017
@cagataycivici cagataycivici added the Type: Bug Issue contains a bug related to a specific component. Something about the component is not working label Aug 22, 2017
@cagataycivici cagataycivici added this to the 4.1.4 milestone Aug 22, 2017
@cagataycivici cagataycivici changed the title [BUG] Spaces are not accepted in p-dropdown filters Spaces are not accepted in p-dropdown filters Aug 22, 2017
@cagataycivici
Copy link
Member

Thanks, fix checked in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
None yet
Development

No branches or pull requests

3 participants