-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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(Popup): add positionFixed
to support fixed mode in Popper.JS
#3760
Conversation
Add support for popper.js to position the popup correctly if used with a mountNode inside a `position: fixed` container
💖 Thanks for opening this pull request! 💖 Here is a list of things that will help get it across the finish line:
We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can. |
Codecov Report
@@ Coverage Diff @@
## master #3760 +/- ##
=======================================
Coverage 99.84% 99.84%
=======================================
Files 175 175
Lines 3125 3125
=======================================
Hits 3120 3120
Misses 5 5
Continue to review full report at Codecov.
|
src/modules/Popup/Popup.js
Outdated
@@ -153,6 +156,7 @@ export default class Popup extends Component { | |||
on: ['click', 'hover'], | |||
pinned: false, | |||
position: 'top left', | |||
positionFixed: false, |
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.
positionFixed: false, |
It's not required to set defaults to false
it(`is "false" by default`, () => { | ||
wrapperMount(<Popup open />) | ||
|
||
wrapper.should.have.prop('positionFixed', false) |
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.
wrapper.should.have.prop('positionFixed', false) | |
wrapper.should.not.have.prop('positionFixed') |
https://github.com/Semantic-Org/Semantic-UI-React/pull/3760/files#r317650640
positionFixed
to support fixed mode in Popper.JS
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.
Left minor comments, looks good to me ❤️
Thanks for the feedback, I removed the unnecessary code. |
src/modules/Popup/Popup.d.ts
Outdated
@@ -107,6 +107,9 @@ export interface StrictPopupProps extends StrictPortalProps { | |||
| 'top center' | |||
| 'bottom center' | |||
|
|||
/** Enables the popper position 'fixed' mode */ |
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.
/** Enables the popper position 'fixed' mode */ | |
/** Tells `Popper.js` to use the `position: fixed` strategy to position the popover. */ |
src/modules/Popup/Popup.js
Outdated
@@ -127,6 +127,9 @@ export default class Popup extends Component { | |||
/** Position for the popover. */ | |||
position: PropTypes.oneOf(positions), | |||
|
|||
/** Enables the popper position 'fixed' mode */ |
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.
/** Enables the popper position 'fixed' mode */ | |
/** Tells `Popper.js` to use the `position: fixed` strategy to position the popover. */ |
Fixes #3718.
Add support for popper.js to position the popup correctly if used with a mountNode inside a
position: fixed
container