-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
bug(button-toggle): changing the name input on button-toggle-group with multiple causes the name on button-toggle components to override #24666
Labels
area: material/button-toggle
P3
An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Comments
If required, I could open a PR for solving this issue |
crisbeto
added a commit
to crisbeto/material2
that referenced
this issue
Mar 31, 2022
…changes Currently we assign the group name to each individual toggle on init or when the group name changes, but that doesn't account for when the toggle's name changes independently. These changes switch to using a getter which will update automatically if anything changes. Fixes angular#24666.
crisbeto
added
P3
An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
has pr
area: material/button-toggle
and removed
needs triage
This issue needs to be triaged by the team
labels
Mar 31, 2022
andrewseguin
pushed a commit
that referenced
this issue
Aug 15, 2022
…changes (#24713) Currently we assign the group name to each individual toggle on init or when the group name changes, but that doesn't account for when the toggle's name changes independently. These changes switch to using a getter which will update automatically if anything changes. Fixes #24666. (cherry picked from commit ed825e6)
andrewseguin
pushed a commit
that referenced
this issue
Aug 15, 2022
…changes (#24713) Currently we assign the group name to each individual toggle on init or when the group name changes, but that doesn't account for when the toggle's name changes independently. These changes switch to using a getter which will update automatically if anything changes. Fixes #24666. (cherry picked from commit ed825e6)
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
area: material/button-toggle
P3
An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Is this a regression?
The previous version in which this bug was not present was
No response
Description
In the
button-toggle
component, there is a bug where the implementation of name (HTML attribute) is inconsistent. A brief description for the bug is:Incase of using the button-toggle group component with the input of
multi
set totrue
and passing aname
input to the parent & differentname
inputs for the button-toggle child elements, thename
(HTML attribute) for the childbutton-toggle
elements are correctly applied at first, but if thename
input for the button-toggle group element is changed again during the lifecycle of the component, thename
(HTML attribute) for the child button-toggle elements simply inherits thename
input value from the button-toggle group.In technical terms, upon the initial load (ngOnInit), the
name
input values passed to the button-toggle child elements is applied to them as theirname
(HTML attribute), but if thename
input is changed for the button-toggle group component later on during the lifecycle of the component, (ngOnChanges), the child button-toggle elements simply uses the newname
input passed to the parent button-toggle group component as theirname
(HTML attribute).PS: even though the use-cases for changing the name are slim, still there seems to be this small leak happening for the case of
multi
set astrue
.Reproduction
Steps to reproduce:
mat-button-toggle-component
when the input ofmulti
for the same is set totrue
mat-button-toggle
gets overridden by thename
input from themat-button-toggle-component
.Expected Behavior
The expected behavior is:
The
name
input passed to the button-toggle group component in the case ofmulti
set astrue
should only be applied to itself, and should not also be applied to the child button-toggles, as the child elements have their ownname
inputs.OR
The
name
input passed to the button-toggle group component in the case ofmulti
set astrue
should also be applied to the child button-toggle elements during the initialization, and not only when thename
input changes for the button-toggle component later during the lifecycle of the component.Actual Behavior
Currently, the
name
input passed to the button-toggle group component is not overriding thename
value (later used as HTML attribute) during the initialization of the component, but only once thename
input is changed for the button-toggle group component later in the lifecycle of the component.Environment
The text was updated successfully, but these errors were encountered: