paper-menu-button icon indicating copy to clipboard operation
paper-menu-button copied to clipboard

restoreFocusOnClosed is a boolean with a default true value which cannot be set to false

Open fejesjoco opened this issue 9 years ago • 3 comments

https://www.polymer-project.org/1.0/docs/devguide/properties#configuring-boolean-properties says:

For a Boolean property to be configurable from markup, it must default to false. If it defaults to true, you cannot set it to false from markup, since the presence of the attribute, with or without a value, equates to true. This is the standard behavior for attributes in the web platform.

But paper-menu-button contains this:

          restoreFocusOnClose: {
            type: Boolean,
            value: true
          },

The default should be false (and the logic could be negated so that it's named noRestoreFocusOnClose).

fejesjoco avatar Aug 20 '16 15:08 fejesjoco

I'm having issues with this too. Is there a way to set restoreFocusOnClose to false on the markup?

fortuna avatar Apr 27 '17 21:04 fortuna

It seems like this could be fixed by changing the default to false, but making it true on hostAttributes.

fortuna avatar Apr 27 '17 22:04 fortuna

To work around the issue, you can override the default on your own code by doing this:

Polymer.PaperMenuButton.prototype.properties.restoreFocusOnClose.value = false;

Make sure to run this only after you loaded paper-button-menu.html.

fortuna avatar Apr 27 '17 22:04 fortuna