-
Notifications
You must be signed in to change notification settings - Fork 46.9k
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
[Suspense] Use !important to hide Suspended nodes #15861
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Suspended nodes are hidden using an inline `display: none` style. We do this instead of removing the nodes from the DOM so that their state is preserved when they are shown again. Inline styles have the greatest specificity, but they are superseded by `!important`. To prevent an external style from overriding React's, this commit changes the hidden style to `display: none !important`. MaYBE AnDREw sHOulD JusT LEArn Css I attempted to write a unit test using `getComputedStyle` but JSDOM doesn't respect `!important`. I think our existing tests are sufficient but if we were to decide we need something more robust, I would set up an e2e test.
threepointone
approved these changes
Jun 11, 2019
No significant bundle size changes to report. Generated by 🚫 dangerJS |
(lint failure btw ^) |
acdlite
added a commit
to acdlite/react
that referenced
this pull request
Jun 14, 2019
Follow up to facebook#15861. Turns out you can't set `!important` using a normal property assignment. You have to use `style.setProperty`. Maybe Andrew *should* just learn CSS. IE9 doesn't support `style.setProperty` so we'll fall back to setting `display: none` without `important`, like we did before facebook#15861 Our advice for apps that need to support IE9 will be to avoid using `!important`. Which seems like good advice in general, but IANACSSE. Tested on FB and using our Suspense DOM fixture.
acdlite
added a commit
to acdlite/react
that referenced
this pull request
Jun 14, 2019
Follow up to facebook#15861. Turns out you can't set `!important` using a normal property assignment. You have to use `style.setProperty`. Maybe Andrew *should* just learn CSS. IE9 doesn't support `style.setProperty` so we'll fall back to setting `display: none` without `important`, like we did before facebook#15861 Our advice for apps that need to support IE9 will be to avoid using `!important`. Which seems like good advice in general, but IANACSSE. Tested on FB and using our Suspense DOM fixture.
acdlite
added a commit
that referenced
this pull request
Jun 14, 2019
Follow up to #15861. Turns out you can't set `!important` using a normal property assignment. You have to use `style.setProperty`. Maybe Andrew *should* just learn CSS. IE9 doesn't support `style.setProperty` so we'll fall back to setting `display: none` without `important`, like we did before #15861 Our advice for apps that need to support IE9 will be to avoid using `!important`. Which seems like good advice in general, but IANACSSE. Tested on FB and using our Suspense DOM fixture.
rickhanlonii
pushed a commit
to rickhanlonii/react
that referenced
this pull request
Jun 25, 2019
Suspended nodes are hidden using an inline `display: none` style. We do this instead of removing the nodes from the DOM so that their state is preserved when they are shown again. Inline styles have the greatest specificity, but they are superseded by `!important`. To prevent an external style from overriding React's, this commit changes the hidden style to `display: none !important`. MaYBE AnDREw sHOulD JusT LEArn Css I attempted to write a unit test using `getComputedStyle` but JSDOM doesn't respect `!important`. I think our existing tests are sufficient but if we were to decide we need something more robust, I would set up an e2e test.
rickhanlonii
pushed a commit
to rickhanlonii/react
that referenced
this pull request
Jun 25, 2019
Follow up to facebook#15861. Turns out you can't set `!important` using a normal property assignment. You have to use `style.setProperty`. Maybe Andrew *should* just learn CSS. IE9 doesn't support `style.setProperty` so we'll fall back to setting `display: none` without `important`, like we did before facebook#15861 Our advice for apps that need to support IE9 will be to avoid using `!important`. Which seems like good advice in general, but IANACSSE. Tested on FB and using our Suspense DOM fixture.
Merged
This was referenced Aug 17, 2019
This was referenced Mar 10, 2020
This was referenced Mar 18, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Suspended nodes are hidden using an inline
display: none
style. We do this instead of removing the nodes from the DOM so that their state is preserved when they are shown again.Inline styles have the greatest specificity, but they are superseded by
!important
. To prevent an external style from overriding React's, this commit changes the hidden style todisplay: none !important
.MaYBE AnDREw sHOulD JusT LEArn Css
I attempted to write a unit test using
getComputedStyle
but JSDOM doesn't respect!important
. I think our existing tests are sufficient but if we were to decide we need something more robust, I would set up an e2e test.