File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -107,6 +107,9 @@ export interface StrictPopupProps extends StrictPortalProps {
107107 | 'top center'
108108 | 'bottom center'
109109
110+ /** Tells `Popper.js` to use the `position: fixed` strategy to position the popover. */
111+ positionFixed ?: boolean
112+
110113 /** An object containing custom settings for the Popper.js modifiers. */
111114 popperModifiers ?: object
112115
Original file line number Diff line number Diff line change @@ -127,6 +127,9 @@ export default class Popup extends Component {
127127 /** Position for the popover. */
128128 position : PropTypes . oneOf ( positions ) ,
129129
130+ /** Tells `Popper.js` to use the `position: fixed` strategy to position the popover. */
131+ positionFixed : PropTypes . bool ,
132+
130133 /** An object containing custom settings for the Popper.js modifiers. */
131134 popperModifiers : PropTypes . object ,
132135
@@ -333,6 +336,7 @@ export default class Popup extends Component {
333336 pinned,
334337 popperModifiers,
335338 position,
339+ positionFixed,
336340 trigger,
337341 } = this . props
338342 const { closed, portalRestProps } = this . state
@@ -369,6 +373,7 @@ export default class Popup extends Component {
369373 eventsEnabled = { eventsEnabled }
370374 modifiers = { modifiers }
371375 placement = { positionsMapping [ position ] }
376+ positionFixed = { positionFixed }
372377 referenceElement = { referenceElement }
373378 >
374379 { this . renderContent }
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import React from 'react'
44import Portal from 'src/addons/Portal/Portal'
55import { SUI } from 'src/lib'
66import Popup from 'src/modules/Popup/Popup'
7- import { positionsMapping } from 'src/modules/Popup/lib/positions.js '
7+ import { positionsMapping } from 'src/modules/Popup/lib/positions'
88import PopupHeader from 'src/modules/Popup/PopupHeader'
99import PopupContent from 'src/modules/Popup/PopupContent'
1010import * as common from 'test/specs/commonTests'
@@ -289,6 +289,20 @@ describe('Popup', () => {
289289 } )
290290 } )
291291
292+ describe ( 'positionFixed' , ( ) => {
293+ it ( `is not defiend by default` , ( ) => {
294+ wrapperMount ( < Popup open /> )
295+
296+ wrapper . should . not . have . prop ( 'positionFixed' )
297+ wrapper . find ( 'Popper' ) . should . not . have . prop ( 'positionFixed' )
298+ } )
299+
300+ it ( `can be set to "true"` , ( ) => {
301+ wrapperMount ( < Popup positionFixed open /> )
302+ wrapper . find ( 'Popper' ) . should . have . prop ( 'positionFixed' , true )
303+ } )
304+ } )
305+
292306 describe ( 'popperModifiers' , ( ) => {
293307 it ( 'are passed to Popper' , ( ) => {
294308 const modifiers = {
You can’t perform that action at this time.
0 commit comments