Skip to content
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

CSS icons fallback #652

Closed
2 tasks done
hatemhosny opened this issue Nov 26, 2024 · 3 comments · Fixed by #654
Closed
2 tasks done

CSS icons fallback #652

hatemhosny opened this issue Nov 26, 2024 · 3 comments · Fixed by #654

Comments

@hatemhosny
Copy link
Collaborator

hatemhosny commented Nov 26, 2024

Type of feature

✨ Feature

Current behavior

hey @gigamaster

I really like the CSS icons you introduced.
I just noticed that CSS masking has baseline compatibility: "newly available".

I generally target this compatibility level for the full app since the users are developers I expect them to have updated browser versions.
However, for embeds I aim to target compatibility level: "widely available" since the users might be less tech-savvy or running in more restricted environments.

In this situtation I prefer to provide fallbacks to make it usable even for older browsers.
CSS isons are used in embeds.

Suggested feature

I'm suggesting a fallback based on your code to use the svg as a background image instead of masks and use invert filter to show hover/active state for light and dark themes.

This would be placed in a @supports block to only work if masks are not supported.
It should otherwise require no code changes.

The icons should appear (without the theme color), but respond with shades of grey on hover/active and for dark/light themes.

This is a demo for the suggestion (icon size is enlarged for the demo): https://livecodes.io/?x=id/ncvsjhnzvep

Please let me know what you think.

Additional context

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Contributing Docs

  • I agree to follow this project's Contribution Docs
@hatemhosny
Copy link
Collaborator Author

If you agree with the approach, I can start a PR with the proposed changes.

@gigamaster
Copy link
Contributor

@hatemhosny
I haven't had any problems using mask. Over the last few years, major browsers implemented mask so quickly that I've stripped out prefixes, e.g. -web-kit, down to the things that matter. But the way you're extending support seems good.

@hatemhosny
Copy link
Collaborator Author

@hatemhosny I haven't had any problems using mask. Over the last few years, major browsers implemented mask so quickly that I've stripped out prefixes, e.g. -web-kit, down to the things that matter. But the way you're extending support seems good.

Thank you @gigamaster

I really like the mask approach. Very neat.

I just think that this addition is an easy win since it adds very little code and might extend support as you say.

By the way, LiveCodes build pipeline uses autoprefixer, so you don't need to manually add vendor prefixes anyway, even for other features.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants