This repository has been archived by the owner on Mar 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
MM-15709 certain aspect ratio of images cause pop on firefox #2826
Merged
Merged
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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.
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.
It is more straight forward and more "idiomatic" in react to set the length in pixels just as integers, and leave react to add the (
px
at the end).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.
i am 0/5 on this but that does not seem "idiomatic" to me. Explicit declaration seemed more natural.
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.
React used to add px to string as well and now apparently they don't do it anymore. Just wondering if they stop deciding to that with numbers we have to all change of these instances. I was checking few issues in react where devs are suggesting to remove this. I feel we should keep it explicit by adding them @jespino
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.
At least it is being considered for adding a warning to explicitly add units in dev env facebook/react#13567
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.
I think the discussion goes more in the way of do not explicitly add "px" for every single number and only do it for certain css properties, like Width, Height, Border, Margin and Padding (and all its variants). I still prefer to use numbers right away, but probably makes sense to hear a third opinion here. @bradjcoughlin what do you think about it?
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.
I'm 1/5 leaning towards specifying
px
for any propertynoton this list: https://github.com/facebook/react/blob/4131af3e4bf52f3a003537ec95a1655147c81270/src/renderers/dom/shared/CSSProperty.js#L15-L59as referenced in the React docs:
https://reactjs.org/docs/dom-elements.html#style
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.
What that says is actually the opposite of that. It says, if you need other unit than
px
you must specify it, if not, you can use a regular number, and add the exceptions lists to clarify where it doesn't auto include thepx
.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.
@jespino right. Not sure why I negated that statement : )
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.
@jespino I feel this would be hard as we have to check for supported properties while programming as well as when reviewing making this harder than needed. Is your suggestion to at-least add it for obvious properties? Final thoughts?
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.
I think extra "thinking" is not needed. The approach is, if your unit is "px", you can use directly a number, if you need to specify the unit, you pass it explicitly. It will add the "px" for that properties where it makes sense, and leave as a number for the properties where it doesn't makes sense.