Skip to content

Commit

Permalink
fix(Popup): fix positioning in scrollable container (#3607)
Browse files Browse the repository at this point in the history
* fix(Popup): fix positioning in scrollable container

* fix class name

* fix condition
  • Loading branch information
layershifter authored May 13, 2019
1 parent 0858664 commit 951d7ce
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/modules/Popup/lib/createReferenceProxy.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import _ from 'lodash'
import { isRefObject } from '../../../lib/refUtils'

class CreateReferenceProxy {
class ReferenceProxy {
constructor(refObject) {
this.ref = refObject
}
Expand All @@ -17,6 +17,10 @@ class CreateReferenceProxy {
get clientHeight() {
return this.getBoundingClientRect().height
}

get parentNode() {
return this.ref.current ? this.ref.current.parentNode : undefined
}
}

/**
Expand All @@ -28,7 +32,7 @@ class CreateReferenceProxy {
*/
const createReferenceProxy = _.memoize(
(reference) =>
new CreateReferenceProxy(
new ReferenceProxy(
// TODO: use toRefObject from Stardust
// https://github.com/stardust-ui/react/issues/998
isRefObject(reference) ? reference : { current: reference },
Expand Down

0 comments on commit 951d7ce

Please sign in to comment.