question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Tooltip child div's getting overridden with selector css definition

See original GitHub issue

Tooltip child div’s getting overridden with selector css defination

Detailed description

Using: import { Tooltip } from 'carbon-components-react';

We are rendering child div inside Tooltip like below:

        <Tooltip
            triggerClassName={styles.trigger}
            triggerText={someText}
            showIcon={false}
          >
            <div className={styles.myCustomStyles}>
              {someStuff()}
            </div>
          </Tooltip>

The CSS for div element will be overridden with below:

.bx--tooltip div {
    display: -ms-flexbox;
    display: flex;
    -ms-flex-pack: justify;
    justify-content: space-between;
    -ms-flex-align: end;
    align-items: flex-end;
    margin-top: 1rem;
}

This will override all the divs inside bx–tooltip which causes problems. Ideally, the consumer should have those definitions for the divs or any other element.

Is this issue related to a specific component? Tooltip from carbon-components-react

What did you expect to happen? What happened instead? What would you like to see changed? This will override all the divs inside bx–tooltip which causes problems. Ideally, the consumer should have those definitions for the divs or any other element.

What browser are you working in? Chrome, Firefox

What version of the Carbon Design System are you using? “carbon-components”: “9.6.1”, “carbon-components-react”: “6.18.3”,

What offering/product do you work on? Any pressing ship or release dates we should be aware of? IGC, Information Server Next code freeze for release: Aug 17, 2018

Steps to reproduce the issue

  1. Import Tooltip from carbon-components-react import { Tooltip } from 'carbon-components-react';

  2. Render it on some element and have a div inside Tooltip component as a child

        <Tooltip
            triggerClassName={styles.trigger}
            triggerText={someText}
            showIcon={false}
          >
            <div className={styles.myCustomStyles}>
              {someStuff()}
            </div>
          </Tooltip>
  1. Inspect on the child div. You will notice the CSS override for element as explained above.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

0reactions
tw15egancommented, Jul 25, 2019

The div styling was removed in this PR, and now just adds basic text styling: https://github.com/carbon-design-system/carbon/pull/2781

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tooltip class mysteriously overridden - html - Stack Overflow
Okay for some ungodly reason my tooltip class isn't working. I assigned my div the class, and the span inside it the tooltiptext...
Read more >
Tooltips - Bootstrap
Documentation and examples for adding custom Bootstrap tooltips with CSS and JavaScript using CSS3 for animations and data-attributes for local title storage.
Read more >
CSS Pseudo-classes - W3Schools
A pseudo-class is used to define a special state of an element. ... Hover over a <div> element to show a <p> element...
Read more >
after - CSS: Cascading Style Sheets - MDN Web Docs - Mozilla
In CSS, ::after creates a pseudo-element that is the last child of the selected element. It is often used to add cosmetic content...
Read more >
Tooltip - Angular Material
Animates the showing and hiding of a tooltip provided position (defaults to below the element). https://material.io/design/components/tooltips.html. Selector: [ ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found