-
Notifications
You must be signed in to change notification settings - Fork 13.5k
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(picker-column-option): add the new component #28591
Conversation
Made a dev build: |
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.
Tested in core and all three frameworks, looks good 👍
@Prop() value?: any | null; | ||
|
||
componentWillLoad() { | ||
this.inheritedAttributes = inheritAriaAttributes(this.el); |
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.
As per the ticket, we should be taking advantage of Stencil's watch decorator for attributes: https://stenciljs.com/docs/reactive-data#watching-native-html-attributes
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.
To add to this, you will still need to get the initial state of the attribute you are trying to reflect. inheritAttributes
would be the better utility for this here, since you only are reflecting the aria-label
(where as inheritAriaAttributes
will parse all aria attributes on the element node). I would assign this to a @State
variable, so a mutation to this variable in the @Watch
function will trigger a re-render to reflect the aria label to the inner button.
The desired behavior is if the developer changes the aria-label
after the initial render of the component, that it will still update in the shadow dom template.
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.
Thank you both for the deeper explanations. I now have a better idea on how this stuff works.
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 aside from Liam and Sean's comments.
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.
As I get into the integration of this component I may make some adjustments to how we set the initial value of ariaLabel
, but I think the stub for this looks good!
A couple lingering things, but otherwise good to go once addressed. Great work!
@State() ariaLabel?: string | null = null; | ||
|
||
/** | ||
* If `true`, the user cannot interact with the select option. |
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.
* If `true`, the user cannot interact with the select option. | |
* If `true`, the user cannot interact with the picker column option. |
const { value, disabled, ariaLabel } = this; | ||
|
||
return ( | ||
<Host id={this.optionId} class={getIonMode(this)}> |
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 doesn't seem to be used anywhere. Can we remove it? (Or document why it's needed)
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 added them for future usage. I'll remove them since this is a stubbed version.
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.
If they are for future usage I'm fine keeping them, I was just hoping we could document why it was needed.
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 was thinking that:
id
would be necessary for children components that act like an option in order to submit the right valuegetIonMode()
would be necessary for styling based on mode
But since I'm not 100% sure if my reasoning is correct and that it's currently not being used, then I removed it.
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.
Thank you!
Issue number: internal
What is the current behavior?
Users have to pass the
options
key in an object to generate the buttons withinpicker-column-internal
.What is the new behavior?
ion-picker-column-option
The new component will replace the need to pass
options
as a key. Since the component is stubbed, it won't have functionality and styles. Those will be applied at a later time.Does this introduce a breaking change?
The changes are being pushed to a branch that targets a major.
Other information
N/A