fabbricadigitale / paper-chip

A chip web component made with Polymer 2 following Material Design guidelines
http://webcomponents.org/element/fabbricadigitale/paper-chip
MIT License
31 stars 16 forks source link

Input elements in content slot break blur functionality #42

Closed ghost closed 7 years ago

ghost commented 7 years ago

Element: paper-chip

Problem If you have for example a paper-icon-button in the content slot it's impossible to register the on-tap event for the button.

Steps to reproduce 1) Create a content slot with for example a paper-icon-button 2) Click on the paper-icon-button

Cause The _onBlur event fires when the focus changes to your paper-icon-button.

Hackish solution

            _onBlur(event) {
                let relatedTarget = event.relatedTarget || null;
                if (relatedTarget !== null) {
                    let parent = relatedTarget.parentElement;
                    while ((parent || null) !== null) {
                        if (parent === this) {
                            return;
                        }
                        parent = parent.parentElement;
                    }
                }
                this.opened = false;
            }

It's definitely not a feasible solution because it is impossible to blur the paper-chip if your input element has focus.

leogr commented 7 years ago

@wvanteijlingen any chance you could make a PR?

leogr commented 7 years ago

Hi @wvanteijlingen , we've added a test and refactored your PRs with a definitive solution, that has been merged (we're going to release a new version).

Let us know if that works as expected and thanks for your contribution!

ghost commented 7 years ago

Hi @leogr

Sure, no problem! Works as expected, thanks for the support.