Skip to content
This repository has been archived by the owner on Dec 19, 2024. It is now read-only.

Detected problem with radio-butons disabled #62

Open
Borjagodoy opened this issue Jul 19, 2016 · 0 comments
Open

Detected problem with radio-butons disabled #62

Borjagodoy opened this issue Jul 19, 2016 · 0 comments

Comments

@Borjagodoy
Copy link

Borjagodoy commented Jul 19, 2016

The Ripple is active in others radio button when click in disable radio button

video example error

I see in the code the posible responsable of this conflict.

I think that the problem is the focus and the itemFocus value.

In the paper-radio-group.html we have the next method.

paper-radio-group.html

_activateFocusedItem: function() { this._itemActivate(this._valueForItem(this.focusedItem), this.focusedItem); },

This method selected the item with new focus. The problem arrive when the component is disable and we selected other radio button undisable, the var this.focusedIem have de old value and don' t change her value to null.

A posible solution is the next.

paper-radio-group.html

_activateFocusedItem: function() { this._itemActivate(this._valueForItem(this.focusedItem), this.focusedItem); this.focusedItem = null; }

The second case is when we tap in radio-button disabled whitout having selected before a radio-button.

The problem detected are in the ion-menu-behaivor on method _onFocuse

iron-menu-behavior.html

_onFocus: function(event) { ... this._defaultFocusAsync = this.async(function() { // focus the selected item when the menu receives focus, or the first item // if no item is selected var selectedItem = this.multi ? (this.selectedItems && this.selectedItems[0]) : this.selectedItem; this._setFocusedItem(null); if (selectedItem) { this._setFocusedItem(selectedItem); } else if (this.items[0]) { // We find the first none-disabled item (if one exists) this._focusNext(); } }); } ...

The first problem arrive when we declared selectedItem

iron-menu-behavior.html

var selectedItem = this.multi ? (this.selectedItems && this.selectedItems[0]) : this.selectedItem;

If we have multiple radio-buttons and one or more are undisable, always selectedItem get some of there undisabl values.

The similar case is in the next if.

iron-menu-behavior.html

... if (selectedItem) { this._setFocusedItem(selectedItem); } else if (this.items[0]) { // We find the first none-disabled item (if one exists) this._focusNext(); } ...

if selectedIem is null, we will get the first element non-disabled, this must be the reason of our error.

This behaivor is used in other paper elements, I don't know the viabilty of change this file.

Could be this posible cause of the error?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant