material-ui icon indicating copy to clipboard operation
material-ui copied to clipboard

[core] Remove useIsFocusVisible util

Open DiegoAndai opened this issue 1 year ago • 2 comments

Part of https://github.com/mui/material-ui/issues/40958 Closes: https://github.com/mui/material-ui/issues/14420

As :focus-visible is now supported in all our supported browsers (reference), we can remove this utility and rely completely on :focus-visible.

This is an intermediate step: ideally, we would use the :focus-visible pseudo-selector directly, but that would mean removing the focusVisible classes and refactoring many components.

DiegoAndai avatar May 31 '24 19:05 DiegoAndai

Netlify deploy preview

https://deploy-preview-42467--material-ui.netlify.app/

Link: parsed: -2.54% :heart_eyes:, gzip: -2.82% :heart_eyes: @mui/joy: parsed: -0.31% :heart_eyes:, gzip: -0.52% :heart_eyes: @material-ui/core: parsed: -0.26% :heart_eyes:, gzip: -0.39% :heart_eyes: @mui/joy/Switch: parsed: -1.95% :heart_eyes:, gzip: -2.23% :heart_eyes: @mui/joy/Checkbox: parsed: -1.80% :heart_eyes:, gzip: -2.06% :heart_eyes: @mui/joy/Radio: parsed: -1.85% :heart_eyes:, gzip: -2.09% :heart_eyes: @mui/joy/Chip: parsed: -1.94% :heart_eyes:, gzip: -2.02% :heart_eyes: @mui/joy/ChipDelete: parsed: -1.65% :heart_eyes:, gzip: -1.82% :heart_eyes: Rating: parsed: -2.14% :heart_eyes:, gzip: -2.24% :heart_eyes: @mui/joy/IconButton: parsed: -1.75% :heart_eyes:, gzip: -1.81% :heart_eyes: @mui/joy/Link: parsed: -1.82% :heart_eyes:, gzip: -2.27% :heart_eyes: @mui/joy/Button: parsed: -1.73% :heart_eyes:, gzip: -1.76% :heart_eyes: @mui/joy/ListItemButton: parsed: -2.02% :heart_eyes:, gzip: -1.99% :heart_eyes: @mui/joy/ModalClose: parsed: -1.61% :heart_eyes:, gzip: -1.84% :heart_eyes: @mui/joy/Slider: parsed: -1.65% :heart_eyes:, gzip: -1.74% :heart_eyes: @mui/joy/Tab: parsed: -1.85% :heart_eyes:, gzip: -1.90% :heart_eyes: @mui/joy/MenuItem: parsed: -1.89% :heart_eyes:, gzip: -1.85% :heart_eyes: @mui/joy/Autocomplete: parsed: -0.84% :heart_eyes:, gzip: -1.01% :heart_eyes: @mui/joy/Option: parsed: -1.90% :heart_eyes:, gzip: -1.84% :heart_eyes: Button: parsed: -17.54% :heart_eyes:, gzip: -17.08% :heart_eyes: and 38 more changes

Bundle size report

Details of bundle changes (Toolpad) Details of bundle changes

Generated by :no_entry_sign: dangerJS against 6c31464921522c1221bd184fff6345ee9ec8e400

mui-bot avatar May 31 '24 19:05 mui-bot

Just a precaution, have you tested that all these components behave identically once moving to use the :focus-visible pseudo selector in the oldest browsers we support? Just to make sure there won't introduce some subtle breaking changes with this.

I tested all browsers, both minimally supported and latest versions. The only thing "not working" is the Link's focus visible in Firefox 115, but that's not working on master (mui.com) either. I think it might be a configuration issue. It's working correctly on the latest Firefox version (127). So, in summary, this is working the same way as master in all supported browsers. This makes sense as we were already relying in :focus-visible on all browsers in which it was available (reference).

This is ready for review 😊

DiegoAndai avatar Jun 19 '24 20:06 DiegoAndai