material icon indicating copy to clipboard operation
material copied to clipboard

mdAutocomplete in mdChips : Can't remove chip on Safari 9 with md-min-length="0"

Open mp-tbianchi opened this issue 10 years ago • 6 comments

Not sure if it's a bug with angular-material or something else.

I slightly modified the Custom Inputs demo : codepen.
I added md-min-length="0" to the autocomplete component and return the full array if no query text is entered : var results = query ? self.vegetables.filter(createFilterFor(query)) : self.vegetables;.

With these options, after entering some values in the third input, Safari 9 can't remove the chip by clicking on the cross. Other browsers are fine.

I'll try looking more into it but if anyone has ideas, I'd be happy to hear them.

mp-tbianchi avatar Apr 19 '16 12:04 mp-tbianchi

I am facing the same issue. Please give your suggestion .

anujsingla avatar Apr 21 '16 12:04 anujsingla

In Chrome & firefox works fine

anujsingla avatar Apr 21 '16 12:04 anujsingla

I can definitely see the bug. The funny thing is that it appears to be a bit finicky. For instance, when I opened the developer tools (trying to inspect the close buttons), it started working like 95% of the time and I had trouble reproducing it. Close the dev tools and refresh, though, and I could only get it to work like 5% of the time. So strange...

Anyway, we'll look into it, but in the meantime, let us know if you find a workaround or can dig in to find the underlying issue.

topherfangio avatar Apr 22 '16 19:04 topherfangio

I am trying to find workaround but did not find any workaround till now ....if anybody find please share .

anujsingla avatar Apr 22 '16 19:04 anujsingla

This issue is closed as part of our ‘Surge Focus on Material 2' efforts. For details, see our forum posting @ http://bit.ly/1UhZyWs.

ThomasBurleson avatar Jun 02 '16 06:06 ThomasBurleson

there is 2 workaround for this bug:

  1. remove md-min-length="0" from the md-autocomplete.

  2. override mdChipRemove directive function MdChipRemove ($timeout) { return { restrict: 'A', require: '^mdChips', scope: false, link: postLink };

    function postLink(scope, element, attr, ctrl) {
        element.on('click mousedown', function(event) {
            if (event.which !== 1) {
                return;
            }
            scope.$apply(function() {
                ctrl.removeChip(scope.$$replacedScope.$index);
            });
        });
    
        $timeout(function() {
            element.attr({tabindex: -1, 'aria-hidden': true});
            element.find('button').attr('tabindex', '-1');
        });
    }
    

    }

anujsingla avatar Jun 02 '16 07:06 anujsingla