-
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
feat(tooltip): allow custom CSS classes for displaying tooltips #4016
feat(tooltip): allow custom CSS classes for displaying tooltips #4016
Conversation
b64f389
to
44f6d2d
Compare
cc @elizabethsjudd due to overlap with #3115 #3151 |
Deploy preview for the-carbon-components ready! Built with commit b64f389 https://deploy-preview-4016--the-carbon-components.netlify.com |
Deploy preview for carbon-components-react ready! Built with commit b64f389 https://deploy-preview-4016--carbon-components-react.netlify.com |
Deploy preview for carbon-elements ready! Built with commit b64f389 |
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 @emyarod!
@elizabethsjudd We are making a change to ally style rules like https://github.com/carbon-design-system/carbon/blob/v10.6.0/packages/components/src/globals/scss/_tooltip.scss#L92-L107 regardless of tooltip's active state, wanted to make sure it won't cause any adverse effect to what you implemented. Thanks!
Deploy preview for the-carbon-components ready! Built with commit 363fb0a https://deploy-preview-4016--the-carbon-components.netlify.com |
Deploy preview for carbon-components-react ready! Built with commit 363fb0a https://deploy-preview-4016--carbon-components-react.netlify.com |
Deploy preview for carbon-elements ready! Built with commit 363fb0a |
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 feel like this is a larger change that we should first decide on in the issue before bringing on an implementation as this heavily ties into tooltips and our ability to make sure they're accessible. I think there are also other approaches we might be able to take on here if we need a generalized tooltip component for these cases
Let’s go with a staged approach to help read-only text input go forward
|
&:hover + .#{$prefix}--assistive-text, | ||
&:focus + .#{$prefix}--assistive-text { | ||
.#{$prefix}--assistive-text, | ||
+ .#{$prefix}--assistive-text { |
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.
Can you help me understand what this sibling selector is doing?
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.
prior to #3115 and #3151 we used ::after
pseudoelements to create the tooltip body. this pattern was changed in those PRs so that the tooltip body is now a div (div.bx--assistive-text
), which can be a sibling or child of the tooltip trigger
the current PR just does these things: deduplicate and simplify selectors, and extract the styles for displaying the tooltip into a mixin
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.
Nice, do we still need the &::after rule then?
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.
yes until the next major version release (for backwards compatibility)
// Forces visible state for definition and icon only tooltip | ||
/// @access public | ||
/// @group tooltip | ||
@mixin tooltip--visible() { |
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.
Is this mixin meant to be public/used elsewhere? Seems unnecessary.
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'm ok with making it private, the idea was to allow the "tooltip visible" rules to be applied to the tooltip trigger wrapper when the tooltip trigger itself cannot display the tooltip properly (e.g. when the trigger is an input field/form control)
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.
Can we defer on read-only until there is a project that can take it on? Seems like there are a couple tooltip-related decisions that it impacts and I'd hate to introduce broader changes without giving it more thought.
Let's limit the scope of tooltip change to introducing a CSS class for the focused state, as what this PR does, to have the read-only text input feature to go forward. |
Should we close this? Not sure if the issue it's attached to is still a concern? |
@shixiedesign @carbon-design-system/design Do we still want tooltip shown on read-only test input as its focused? Asking this question because #4015 and this PR seems for enhancing tooltip style for that purpose. Thanks! |
|
||
.#{$prefix}--assistive-text, | ||
+ .#{$prefix}--assistive-text { | ||
clip: auto; |
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.
isn't clip: auto the default? Is the a reason we set it 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.
Not sure we're still pursuing this but lgtm!
Should we go ahead and close this unless there is a designer/dev on a project team that can pick this up? |
@emyarod I think you are still pursuing this, is it correct? |
yes the remaining work is complete minus the tooltip behavior which depends on this PR |
I don't know the history of this problem and Shixie has been off-boarded, but was tooltip added to read-only text input as a band-aid? Why was it needed in the first place? How do I see the read-only variant? I don't see a knob for that in the story book. |
We should try and save this for when a project team can work on/address this. I think the decisions made for this have broad impact and could require alignment from design/dev/a11y which are hard when we're all working on a different project at the moment 👍 |
Going to close this until we can pick things back up 👍 |
Closes #4015
This PR extracts the tooltip display code in a new mixin called
tooltip--visible()
Changelog
New
tooltip--visible()
Sass mixin containing style rules needed to display definition and icon tooltipsChanged
:hover
and:focus
selectorsTesting / Reviewing
.bx--test
and.bx--test--focus
)ensure that the tooltip is open by default and ensure existing tooltip implementation is not broken