question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

While using autocomplete in modal form any click outside tags input doesn't close autocomplete items

See original GitHub issue

I’m submitting a … (check one with “x”)

[ ] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[x] support request/question

Current behavior I’m using tags input and autocomplete inside a modal window. When I start typing any new tag autocomplete shows me variants among items as must. But it doesn’t hide himself if I click anywhere on the modal window outside tag input or even if there is no items in autocomplete to match (an empty small white div block is still shown). Could not figure out can I somehow override trigger events so they can work properly inside modal form or any workaround how I can trigger autocomplete menu to close.

Minimal reproduction of the problem with instructions (if applicable)

Angular 4 bootstrap modal window with this code

<tag-input
            [(ngModel)]="items"
            [maxItems]='5'
            [ngModelOptions]="{standalone: true}"
            [onlyFromAutocomplete]="false"
            #input>
            <ng-template let-item="item" let-index="index">
                <span>{{ item.display || item}}</span>
                <span class="glyphicon glyphicon-remove" (click)="input.removeItem(item, index)"></span>
            </ng-template>

            <tag-input-dropdown [autocompleteItems]="autocomplete">
            </tag-input-dropdown>
        </tag-input>

Same issue for angular 2 modal window

What is the motivation / use case for changing the behavior? (if applicable) Use autocomplete fully on modal windows

What do you use to build your app? (SystemJS, Webpack, angular-cli, etc.). Please specify the version angular-cli 1.0.3

Angular version: angular 4.1.0

ng2-tag-input version: ngx-chips 1.4.6

Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ] Tested on Chrome and Safari for different versions

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:4
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
Gbuompriscocommented, Aug 3, 2017

Either that, or respond to any blur events and call tagInput.dropdown.hide()

1reaction
anatoliykolinkocommented, Aug 3, 2017

My solution on that is to clear out input form value,

You are able to bind id to your element: <tag-input … #yourId>

Then just get it like a view child in your component: @ViewChild(‘yourId’) tagInput: TagInputComponent;

And subscribe to modal:

modalComponent.onDismiss.subscribe(() => { this.tagInput.setInputValue(‘’); });

modalComponent.onClose.subscribe(() => { this.tagInput.setInputValue(‘’); });

Read more comments on GitHub >

github_iconTop Results From Across the Web

Autocomplete issue into bootstrap modal - Stack Overflow
When I mouse scroll, the results do not remain attached to the input. Is there a way to solve this? Here JsFiddle: .ui-autocomplete-input...
Read more >
React Autocomplete component - Material UI - MUI
The autocomplete is a normal text input enhanced by a panel of suggested options. The widget is useful for setting the value of...
Read more >
How To Turn Off Autocomplete for Input - W3Schools
Use the autocomplete attribute to turn off autocomplete for input fields: ... Tip: Go to our HTML Form Tutorial to learn more about...
Read more >
AutoComplete - Ant Design
When you need input suggestions or helping text. The differences with Select are: AutoComplete is an input box with text hints, and users...
Read more >
lightning-input - documentation - Salesforce Developers
Checkboxes let you select one or more options. lightning-input type="checkbox" is useful for creating single checkboxes. If you are working with a group...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found