-
Notifications
You must be signed in to change notification settings - Fork 1.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
fix(tag): use refs to handle component access #16571
fix(tag): use refs to handle component access #16571
Conversation
When using the querySelector it is easily broken if the id has reserved characters. Also the isEllipsisActive helper had no protection for a non element.
✅ Deploy Preview for carbon-elements ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for v11-carbon-react ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
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.
Thanks again for the quick fix!
Hey real quick before we merge this I'm going to correct the deprecation notices |
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.
Thanks for the fix!
Thanks for that! I added a |
return ( | ||
<ComponentTag className={tagClasses} id={tagId} {...other}> | ||
<ComponentTag ref={tagRef} className={tagClasses} id={tagId} {...other}> |
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.
should this not be ref too now?
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.
Actually we can remove the ref from this one. The filter
prop should be replace with the new variant Dissmisible Tag
so we don't have to add the new functionality to the old filter
tag.
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.
but isn't the Dismissible Tag
experimental? so you still need it there until it is fully deprecated
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 see your point. It is something I will take to the team to talk about it. Since we have implemented in the Dissmisible Tag
it would be quick to implement on the old filter prop.
But for now the spec we have is only in the new Intereactive Tag.
…6571) * fix(tag): use refs to handle component access When using the querySelector it is easily broken if the id has reserved characters. Also the isEllipsisActive helper had no protection for a non element. * fix(tag): cast BaseComponent type * fix(tag): improve deprecation notices * fix: added forwardRef to Tag to grab ref in variants * fix: removed console log * fix: fixed spelling and remove ref from old filter * fix: updated snapshots * fix: fixed onMouseEnter error on console * fix: fixed TS error --------- Co-authored-by: Taylor Jones <[email protected]> Co-authored-by: guidari <[email protected]>
Closes #16570
When using the querySelector it is easily broken if the id has reserved characters also the isEllipsisActive helper had no protection for a non element. So now using refs to access the DOM element and the helper has been extracted for reuse and includes extra protection.
Changelog
New
Changed
Removed
Testing / Reviewing
N.B. There was no testing in place around the recent changes that were added, it is strongly advised that we need tests here both unit and E2E.