Skip to content

Commit

Permalink
fix(NumberFormat): fix tooltip theme inheritance (#2354)
Browse files Browse the repository at this point in the history
  • Loading branch information
tujoworker committed May 31, 2023
1 parent 862add3 commit 59c79ae
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/dnb-eufemia/src/components/number-format/NumberUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -856,13 +856,15 @@ export function showSelectionNotice({ value, label, timeout = 3e3 }) {
return { run: () => {} }
}

let elem, content
let elem, content, root

try {
root = document.querySelector('.dnb-tooltip__portal, body')

// create that portal element
elem = document.createElement('span')
elem.setAttribute('id', id)
elem.setAttribute('class', 'dnb-tooltip dnb-core-style')
elem.setAttribute('class', 'dnb-tooltip')
elem.setAttribute('role', 'tooltip')

const arrow = document.createElement('span')
Expand All @@ -882,7 +884,7 @@ export function showSelectionNotice({ value, label, timeout = 3e3 }) {
return new (class SelectionFx {
remove() {
try {
document.body.removeChild(elem)
root.removeChild(elem)
elem = null
content = null
} catch (e) {
Expand All @@ -898,7 +900,7 @@ export function showSelectionNotice({ value, label, timeout = 3e3 }) {
}
run(pE = getSelectedElement()) {
try {
document.body.appendChild(elem)
root.appendChild(elem)

const top = getOffsetTop(pE)
const left = getOffsetLeft(pE)
Expand Down

0 comments on commit 59c79ae

Please sign in to comment.