Skip to content
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

show popup at the same document as the trigger element #227

Merged
merged 2 commits into from
Dec 4, 2020

Conversation

rinick
Copy link
Contributor

@rinick rinick commented Dec 3, 2020

use getRootDomNode() to find the correct document instead of using the default global one.

resolves ant-design/ant-design#28165

@codecov
Copy link

codecov bot commented Dec 3, 2020

Codecov Report

Merging #227 (ab36f90) into master (960f146) will increase coverage by 0.06%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #227      +/-   ##
==========================================
+ Coverage   88.95%   89.01%   +0.06%     
==========================================
  Files          11       11              
  Lines         516      519       +3     
  Branches      130      131       +1     
==========================================
+ Hits          459      462       +3     
  Misses         57       57              
Impacted Files Coverage Δ
src/index.tsx 85.16% <100.00%> (+0.13%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 960f146...ab36f90. Read the comment docs.

@afc163 afc163 requested a review from zombieJ December 3, 2020 06:24
@zombieJ zombieJ merged commit 4259210 into react-component:master Dec 4, 2020
@zombieJ
Copy link
Member

zombieJ commented Dec 4, 2020

+ [email protected]

function returnDocument() {
function returnDocument(element?: HTMLElement) {
if (element) {
return element.ownerDocument;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be

Suggested change
return element.ownerDocument;
return element.getRootNode?.() || element.ownerDocument;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

@rinick rinick Jan 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JohnDeved

popup can not be created in shadow dom.

the reason we need this package for popup is because popup should stay on top of everything.
showing popup in shadow dom means it can be blocked by parentNode's overflow style or by other elements.

for special case when you really need it to be inside shadow-dom, could you use getPopupContainer ?

rinick added a commit to rinick/trigger that referenced this pull request Mar 23, 2021
…nt#227)

* show popup at the same document as the trigger element

* use current document in all use cases
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

使antd兼容react-new-window
3 participants