PolymerElements / paper-input

A Material Design text field
https://www.webcomponents.org/element/PolymerElements/paper-input
130 stars 162 forks source link

IE 11 - Custom Properties Not Reflecting Changes with Pseudo Class Hover #572

Open chuangbert opened 6 years ago

chuangbert commented 6 years ago

Description

IE 11 fails to reflect custom property changes with pseudo class hover.

#someElement:hover {
    --paper-input-container-input-color: red;
    ...
}

Expected outcome

In IE 11, hovering over the element updates the color

Actual outcome

No changes occur

Live Demo

Steps to reproduce

Browsers Affected

notwaldorf commented 6 years ago

Is this for Polymer 1 or 2? Is this in a <custom-style> or a style is="custom-style"? Please provide a jsbin with repro steps, as there's a million things that could go wrong here.

chuangbert commented 6 years ago

Hey @notwaldorf, this is for Polymer 2. And here's a sample: http://plnkr.co/edit/Uvd91m1RRv0OPwXCHYYG?p=preview Thanks for the response

notwaldorf commented 6 years ago

Hmm, does it work if you include the apply-shim polyfill (https://www.polymer-project.org/2.0/docs/devguide/custom-css-properties#use-custom-css-mixins) and the custom-style polyfill (https://www.polymer-project.org/2.0/docs/devguide/custom-css-properties#use-css-inheritance) ?

chuangbert commented 6 years ago

Added both files and no go :(

These are the files:

<link rel="import" href="../polymer/lib/elements/custom-style.html">
<link rel="import" href="../shadycss/apply-shim.html">
notwaldorf commented 6 years ago

I thiiiiink this may be a shim limitation, and the idea is basically that custom property isn't updated correctly on hover (hovering doesn't tell the styling system to update it, basically). To test this, you might want to call updateStyles on a mouseover or something, which is pretty ugh.

/cc @azakus to confirm.

chuangbert commented 6 years ago

Thanks for the suggestion...tried the following but it also didnt work.

<paper-dropdown-menu on-mouseover="willThisWork">...</paper-dropdown-menu>
this.updateStyles({
              '--paper-input-container-color': 'red',
            });
mleonardallen commented 6 years ago

@chuangbert @notwaldorf I was able get updateStyles to work by applying updateStyles to the child element.

let paperDropdownMenu = this.$.paperDropdownMenu.shadowRoot ? this.$.paperDropdownMenu.shadowRoot : this.$.paperMenu;
let input = paperMenu.querySelector('paper-input');

window.ShadyCSS.styleSubtree(/** @type {!HTMLElement} */(input), {
  '--paper-input-container-input-color': 'red'
});

// or
let updateStyles = this.updateStyles.bind(input);
updateStyles({'--paper-input-container-input-color': 'red'});
mtallenca commented 6 years ago

Not just a hover problem, I am seeing this error just by dynamically adding a class. Edge paints the paper-input fine on load. Adding a class to the paper-input after the initial load that has modified custom attribute does not update. Calling updateStyles() on the paper-input does work.