-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deserialization of HTML attributes in Polymer.PropertyAccessors mixin #4689
Comments
This is not how HTML boolean attributes work. Any value means |
@web-padawan - Thank you for the clarification. So you can ignore item #2 in the "Steps to Reproduce" section. I actually do not need different behavior. The Polymer.IronControlState. sets the default value for the It is quite possible that I am proposing the correction in the wrong piece of code. As I said in the beginning I am very new to using Polymer. I was just trying to be helpful and propose a solution, which seems to make the paper-dropdown-menu behave in the expected manner of being an active element (i.e. not disabled). |
@alim The paper-dropdown-menu element should already be enabled by default, so I'm confused as to why you would set As @web-padawan is suggesting, the existence of the disabled attribute at all counts as |
@azakus - Thanks for the reply. I was expecting the paper-dropdown-element to be working be default. You can ignore my misguided attempt to set the
The element is displayed, but is disabled. We tested this running 1.9 and 2.0 Polymer with in a Rails 5.1 application and got the same results. I am betting there is a better place to correct this behavior then the one I proposed, I just have not had time to re-run the stack trace. We just noticed that default |
@alim I got what you are trying to put forward. The actual issue is for deserialization of Boolean values.
to
|
I am unable to reproduce the described issues: http://jsbin.com/hodizecuyi/edit?html,console,output Since Polymer handles boolean attributes in the same way as the HTML specification does (https://www.w3.org/TR/2008/WD-html5-20080610/semantics.html#boolean) I think this is working as intended. |
Description
First off let me say I am new to Polymer and JavaScript is not my strong suit. So, hopefully, I am not too far off base here.
We are using Polymer 2.0 and paper-input-elements in conjunction with a Rails 5.1 web application. In particular we are using the paper-dropdown-menu in an Rails view template, along with paper-input elements. Both elements are at version 2.0. The paper-input elements work fine. The paper-dropdown-menu displays as disabled in both Chrome (59.0.3071.86) and Firefox (53.0.3).
Steps to Reproduce
Create a Rails html.erb file with the sample paper-dropdown-menu code
in it as follows:
Use either default
disabled
property for the paper-dropdown-menuelement or try to set it to
false
directly as follows:Run the Rails application to display the page.
Expected Results
We expect to see the paper-dropdown-menu menu element displayed and
enabled so we can select one of the dropdown options.
Actual Results
The paper-dropdown-menu element is displayed but "grayed" out and
does not respond to mouse or keyboard input.
Diagnosis and Proposed Fix
In debugging the problem, I found the following:
The paper-dropdown-menu element includes a mixin that sets the
default value for the
disabled
attribute tofalse
. The mixin isPolymer.IronControlState.
When the page is displayed this default value is deserialized and the
default value is converted to
true
. This deserialization takes placein Polymer.PropertyAccessors. The code that deserializes the
Boolean value is here
and shown below:
I believe unless the value is
null
, it will always converts the Booleanvalue to
true
. This conversion causes the paper-dropdown-menuto be disabled.
I would propose the following change that is shown below and in a
forked copy of the repository on the deserialize branch
here.
The suggested change is below:
If you think I captured the solution correctly or you have suggestions
for any changes, I would be happy to submit a pull request.
Browsers Affected
Versions
The text was updated successfully, but these errors were encountered: