ng2-completer icon indicating copy to clipboard operation
ng2-completer copied to clipboard

Implement forceSelection attribute

Open gRoussac opened this issue 8 years ago • 6 comments
trafficstars

Hi,

Thanks for your nice work on this component.

As user story, we would like to prevent the closing of the dropdown menu on hitting "Enter" ~~or "Tab"~~ when nothing was selected in the dropdown. We could not find an option corresponding to that case or maybe we missed it in the doc, if so please any advise appreciated.

The pull request may not be perfect but you get the point I hope.

Best regards,

Greg

gRoussac avatar Jun 07 '17 15:06 gRoussac

Hi @gRoussac,

Thanks for the PR, it's a nice addition. Will try to check it soon and if there are no issues will merge it.

oferh avatar Jun 09 '17 15:06 oferh

Yes please check if blur event is also behaving accordingly (not going through handleSelection if there was no selection) Thanks ! success !

gRoussac avatar Jun 09 '17 16:06 gRoussac

@gRoussac when blur is triggered for other reasons, like mouse press outside the component, forceSelection is not checked

oferh avatar Jun 24 '17 04:06 oferh

On blur forceSelection is not checked and should not be. You are just leaving the input, I do not really get was I was trying to say/secure with this blur, seems to work correctly with forceSelection enabled ( ie: close the menu, no point in preventing going out of the component here)

(clearUnselected option is I guess was I was missing for the blur part, which enables to force a selection in items or nothing; i.e having forceSelection to true and clearUnselected to false might not be very consistent in ux)

(Btw clearUnselected option seems to bug with ESC key fyi)

gRoussac avatar Sep 16 '17 03:09 gRoussac

Not sure I pulled the right branch. This PR is update to master branch though but was made against the dev one :trollface:.

gRoussac avatar Sep 16 '17 03:09 gRoussac

Is it possible for someone to merge this PR with the master branch, to fix the annoying Enter issue! Thanks

landworth avatar Jan 14 '19 03:01 landworth