-
Notifications
You must be signed in to change notification settings - Fork 6.8k
feat(material/slide-toggle): allow focus origin to be optional input in focus method #20913
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
feat(material/slide-toggle): allow focus origin to be optional input in focus method #20913
Conversation
@@ -759,6 +762,15 @@ describe('MatSlideToggle with forms', () => { | |||
expect(slideToggle.disabled).toBe(false); | |||
expect(inputElement.disabled).toBe(false); | |||
}); | |||
|
|||
it('should not change focus origin if origin not specified', () => { | |||
slideToggle.focus('mouse'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar issue to here: #20912.
Would like to call focus on the button in the form, setting the origin to some value and then calling focus on slideToggle and expecting it to remain unchanged.
a326702
to
d82fdb2
Compare
Linter throwing error stating my commit message is longer than 120 char, but it is not? |
19102ad
to
472ff41
Compare
472ff41
to
648f02a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
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. |
WHAT: For Angular Material components that have a focus() method, allow for the origin param to be optional and remove the default origin value.
WHY: For cases where the focus() method is called and the origin is already defined, we don’t want to override the origin using focusVia to always be some default value. In many cases, we want to leave the origin unchanged, but if there are cases that need the origin to be updated, allow for this with an optional origin param.