Fabric 7.23 is adding ~1.3kB to Checkbox
Pr responsible for size increase: https://github.com/OfficeDev/office-ui-fabric-react/pull/9815 This seems to be a big increase for an extra feature.
Priorities and help requested:
Are you willing to submit a PR to fix? No
Requested priority: High
Products/sites affected: OutlookWeb fabric updates
Thanks @apneer :)
This I believe was due to indeterminate state support being added.
https://github.com/OfficeDev/office-ui-fabric-react/pull/9815/files
Of the 1.3k added, i am estimating (looking at the size auditor report) about 800 bytes were from the .styles update, and 500 were from the .base update.
I think the feature of supporting indeterminate is important for a number of scenarios. Do you see ways to reduce the impact here and still support indeterminate?
Paging @maxwellred :)
I could see a few bytes savable in the styling:
[`:hover .${classNames.checkbox}`]: {
background: checkboxBackgroundCheckedHovered,
borderColor: checkboxBorderColorCheckedHovered
},
[`:focus .${classNames.checkbox}`]: {
background: checkboxBackgroundCheckedHovered,
borderColor: checkboxBorderColorCheckedHovered
},
I believe these redundant selectors could just be collapsed:
[`:hover .${classNames.checkbox}, :focus .${classNames.checkbox}`]: {
background: checkboxBackgroundCheckedHovered,
borderColor: checkboxBorderColorCheckedHovered
},
I see a number of redundant classes.
@dzearing wouldn't collapsing those selectors make it that much harder/nigh impossible to say, just overwrite just the hover style border color? You will have to resort to specificity/!important
I have been talking to @apneer about this on the side to determine possible resolutions. This is a core feature since native input supports indeterminate, so I was going to look at methods for reducing the implementation size.
In addition to the things you pointed out, there seems to be both redundant logic and styling in Checkbox.styles.ts. indeterminate is checked both inside of indeterminateDotStyles and before it's applied in the only place I see it used. This seems to imply that the logic is redundant and that some of the styling is dead code and would never be applied correctly. Hoping @maxwellred can add some input too.
@cliffkoh Having a comma delimited selector does not increase specificity; but I don't think that's what you meant. I think you meant overriding the exact selector is now harder.
Honestly I don't expect a developer to be overriding these, and if they are, just use !important, because assuming that you can override a selector with 2 levels of specificity is just too fragile to design around (especially when you add a dynamically generated classname.)
This is what prompted the tokens discussion.
:tada:This issue was addressed in #10170, which has now been successfully released as [email protected].:tada:
Handy links: