The CSS reset seems to be working great and didn't break anything.....jk ๐ ๐น ! Here's what the Messages blank slate looked like for a little while (now fixed):
The CSS reset blew things up because the height and width got passed as props to the Image component, which means that they're set as attribute properties directly on the image. i.e. this
Because width and height attributes in images and iframes have (thanks for the link @Charca) the weakest specificity of all, that meant that the reset was resetting them to initial, letting them balloon in size ๐ซ !
This was an issue that @ryan-mulrooney noticed in Message and a few other places in hs-app when QAing the original reset PR and led to adding the cssReset prop to toggle it on and only doing so in hs-app-ui and not hs-app...which works great except we didn't totally connect the dots that Messages is in hs-app-ui now so the prop didn't prevent this case from happening.
Solution
There was an easy immediate fix for this particular case that @jakubjanczyk took, which was just to move the width and height declarations out of props passed to the component and into CSS rules in the Styled Component (since the SC class specificity would be higher then and the issue wouldn't happen).
So we're okay now, but @Charca noted:
for the future, I'm wondering whether we could not reset width and height for elements that could take a presentational attribute (img, iframe, svg, etc) to prevent cases like this one? Although now that we're using the css reset, cases like this one will be much more obvious in the future, so we probably don't have to worry too much about it.
That makes sense to me, so this PR makes that change!
Guidelines
Make sure the pull request:
[ ] Follows the established folder/file structure
[ ] Adds unit tests
[ ] If it is a refactor or change to an existing component, have you verified it won't break existing Cypress tests or have you updated them?
[ ] Did you verify some accessibility (a11y) basics?
Problem/Feature
The CSS reset seems to be working great and didn't break anything.....jk ๐ ๐น ! Here's what the Messages blank slate looked like for a little while (now fixed):
The CSS reset blew things up because the
height
andwidth
got passed as props to theImage
component, which means that they're set as attribute properties directly on the image. i.e. thisRenders as this HTML:
Because
width
andheight
attributes in images and iframes have (thanks for the link @Charca) the weakest specificity of all, that meant that the reset was resetting them toinitial
, letting them balloon in size ๐ซ !This was an issue that @ryan-mulrooney noticed in Message and a few other places in
hs-app
when QAing the original reset PR and led to adding thecssReset
prop to toggle it on and only doing so inhs-app-ui
and noths-app
...which works great except we didn't totally connect the dots that Messages is inhs-app-ui
now so the prop didn't prevent this case from happening.Solution
There was an easy immediate fix for this particular case that @jakubjanczyk took, which was just to move the
width
andheight
declarations out of props passed to the component and into CSS rules in the Styled Component (since the SC class specificity would be higher then and the issue wouldn't happen).So we're okay now, but @Charca noted:
That makes sense to me, so this PR makes that change!
Guidelines
Make sure the pull request:
proptypes
) Guidelines