-
Notifications
You must be signed in to change notification settings - Fork 77
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: Refactoring host element inconsistencies #2059
Comments
Agreed. We should avoid tacking on to the host anything that can be encapsulated. Once we solidify the list of exceptions, we could add a rule to enforce it. How do we want to divvy up the list? |
Agree we should clean these up and be really careful what we put on the host. Most of these are probably going to be for styling purposes as we use selectors like If props really need to be on a host element, we can use The |
In most cases, we don't even need to import and return the host if we aren't' setting anything on it. So best bet would be to just not import and use the Host element. It would definitely help if we had a rule where when host is used we could only set aria prefixed attributes as well as tabIndex. |
@jcfranco : 1-5 Sound good? |
Is this part of the current 🏃🏻 ? |
Good question. Do you think it should be @jcfranco @paulcpederson @julio8a? |
If this is something you guys feel comfortable with completed by the end of the sprint (5/7), Yes. |
thinking |
@driskull @jcfranco @paulcpederson Should I add this to this sprint? |
I got 5 of them done but I'm not sure if the rest could be done for this sprint. Maybe safer for next sprint? |
Cool. i'll steal them back. |
1 – 5 installed! |
The rest of mine are installed. We just need #2114 installed. |
I've got a PR coming that will use custom a ESLint rule to catch cases where banned host attributes/props are used. We can verify with that. cc @julio8a |
Verified on my local master branch by running
Marking this one verified and closing per Sprint planning conversation. |
Actual Behavior
Some of the components are setting attributes on the host element and they maybe shouldn't be. Lets discuss what to do in these scenarios.
Expected Behavior
Host element should only have needed props and attributes applied to it. Things like aria roles, tabIndex, id and event listeners.
Reproduction Steps or Sample
<Host aria-expanded={this.active.toString()} icon-position={this.iconPosition} tabindex="0">
Why iconPosition? Should it be a prop? iconPosition is a private variable but gets set on the host element.<Host active={active} aria-hidden={hidden.toString()} aria-label={this.label} calcite-hydrated-hidden={hidden} queued={this.queued} role={role}>
Why queued and active?<Host aria-label={hex} title={hex}>
Why title? Should it be internal?<Host aria-hidden disabled={this.disabled} scale={scale} tabIndex={-1}>
Why disabled? Scale as well? These are already props.<Host scale={scale}>
Why scale here?<Host role="menu" scale={scale} title={this.groupTitle}>
Why title & scale?<Host aria-checked={itemAria} dir={dir} isLink={this.href} role={itemRole} scale={scale} selection-mode={this.selectionMode} tabindex="0">
Why isLink, scale, selectionMode?<Host calcite-hydrated-hidden={hidden} theme={this.theme}>
Why theme?<Host aria-modal="true" is-active={this.isActive} role="dialog">
Why is-active?<Host active={this.active} dir={dir}>
Why active?<Host labeled={!!this.el.textContent}>
Why labeled? what is that for?<Host appearance={appearance} aria-checked={checked.toString()} layout={layout} role="radio" scale={scale}>
Why appearnace, layout, scale?<Host id={id} is-range={this.isRange}>
Why isRange?<Host aria-controls={this.controls} aria-expanded={this.active.toString()}hasText={this.hasText} id={id} role="tab" tabindex={this.disabled ? "-1" : "0"}>
Why hasText?<Host data-id={this.guid}>
Why data-id?Relevant Info
The text was updated successfully, but these errors were encountered: