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

[fixed]: css class added to root document instead of modal ownerDocument #965

Merged
merged 1 commit into from
Sep 16, 2022

Conversation

leoc4e
Copy link
Contributor

@leoc4e leoc4e commented Sep 12, 2022

Fixes #[964]
I am trying to open the modal inside an iframe, but the bodyOpenClassName would be applied to the rootDocument instead.
I would like to use the parentSelector to determine where the bodyOpenClassName should be added instead of just using document.body

Changes proposed:

  • htmlOpenClassName add to the modal ownerDocument html instead
  • bodyOpenClassName add to the modal ownerDocument body instead
  • Update doc

Upgrade Path (for changed or removed APIs):

Acceptance Checklist:

  • The commit message follows the guidelines in CONTRIBUTING.md.
  • Documentation (README.md) and examples have been updated as needed.
  • If this is a code change, a spec testing the functionality has been added.
  • If the commit message has [changed] or [removed], there is an upgrade path above.

@leoc4e leoc4e changed the title [fixed]: css class added to root document in iframe [fixed]: css class added to root document instead of modal ownerDocument Sep 12, 2022
@diasbruno
Copy link
Collaborator

LEGIT.

@leoc4e
Copy link
Contributor Author

leoc4e commented Sep 15, 2022

@diasbruno
Is there anything I should do for this PR to move forward?

@diasbruno
Copy link
Collaborator

I didn't have time to look at it, but one thing is I don't know how old is ownerDocument. If you can have look on it to see if it is safe to use, then ok...

@leoc4e
Copy link
Contributor Author

leoc4e commented Sep 16, 2022

I think it should be safe to use,
image
https://developer.mozilla.org/en-US/docs/Web/API/Node/ownerDocument
https://caniuse.com/?search=ownerDocument
it is supported even for IE 6 in 2002
for android it is not supported until 4.4 (2014)

And since I am using (parentSelector && parentSelector().ownerDocument) || document
it should fallback to use the document if ownerDocument is undefined/null🤞

@diasbruno
Copy link
Collaborator

diasbruno commented Sep 16, 2022

Great. Thanks for the PR e bom trabalho!

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.

bodyOpenClassName is added to incorrect document
2 participants