-
Notifications
You must be signed in to change notification settings - Fork 7
Modernize polaris-radio-button component #504
Modernize polaris-radio-button component #504
Conversation
a085d4d
to
3646e7c
Compare
checked={{@checked}} | ||
disabled={{@disabled}} | ||
aria-describedby={{this.describedBy}} | ||
onchange={{action (or @onChange this.onChange) value="target.value"}} |
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.
Left the action
helper here because the fn
wasn't working as expected when passing value="target.value"
🤷♂
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.
@tomnez can you try
<input ...... {{on "change" (or @onChange this.onChange)}} ....>
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.
This still passes the event
as the first (and only) argument now rather than the expected value 🤷♂
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.
not really a problem, we can just handle in the local action right? as the example here
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.
Yeah we can do that 👍
checked={{@checked}} | ||
disabled={{@disabled}} | ||
aria-describedby={{this.describedBy}} | ||
onchange={{action (or @onChange this.onChange) value="target.value"}} |
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.
@tomnez can you try
<input ...... {{on "change" (or @onChange this.onChange)}} ....>
disabled={{@disabled}} | ||
aria-describedby={{this.describedBy}} | ||
onchange={{action (or @onChange this.onChange) value="target.value"}} | ||
onfocus={{fn (or @onFocus this.onFocus)}} |
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.
same...let's use the on
modifier for these last 2
checked={{@checked}} | ||
disabled={{@disabled}} | ||
aria-describedby={{this.describedBy}} | ||
onchange={{action (or @onChange this.onChange) value="target.value"}} |
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.
not really a problem, we can just handle in the local action right? as the example here
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.
1 small comment and then this should be good to go
checked={{@checked}} | ||
disabled={{@disabled}} | ||
aria-describedby={{this.describedBy}} | ||
{{on "change" (or @onChange this.onChange)}} |
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.
I think we still want to pass the value to the onChange
action....assuming we were correct and that's what the react implementation does
PS: we shouldn't modify tests to match our implementation.....but make sure tests are testing correct behavior and we pass 😬
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.
check the example I've posted earlier....that should be in the component not in the tests
let me know if this doesn't makes sense pls
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.
Ah so you mean we want a middle-man method (something like a private handleChange
action) where we grab the value and then call onChange
?
Originally when you said
we can just handle in the local action
I thought you meant that the passed-in onChange
would be responsible for this. Sorry about the confusion 😬
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.
yeah, like handleChange
moving this to the caller onChange
would mean we break the API of this component...which we don't want
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.
yasss 🚀
DEV-76
Updates
PolarisRadioButton
to tagless component, ES6 classes, and angle bracket syntax.Dummy app: