-
Notifications
You must be signed in to change notification settings - Fork 234
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
fixed color glitches in FireFox #318
Conversation
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 works, thank you!
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.
@prem-k-r please review it
I guess it’s ok
Github trick: You can write as |
This change will disable live changes of colors in Chrome. I think live updates provide a better user experience. Therefore, I am merging this change into the Firefox-specific branch. Screencast.From.2024-12-16.18-27-12.mp4 |
I'd like for this to be reopened and changed the code to: // Function to detect if the browser is Firefox
function isFirefox() {
return navigator.userAgent.toLowerCase().includes('firefox');
}
// Apply appropriate listeners based on the browser
if (isFirefox()) {
// Add listeners for Firefox
colorPicker.removeEventListener('change', handleColorPickerChange);
colorPicker.addEventListener('change', handleColorPickerChange);
} else {
// Add listeners for Chrome and Safari
colorPicker.removeEventListener('input', handleColorPickerChange);
colorPicker.addEventListener('input', handleColorPickerChange);
} And remove the Firefox-specific branch I've tested it on both Firefox and Chrome, and it works. Also, to make the code more solid, create a folder: // browserUtils.js
/**
* Detect if the browser is Firefox.
* @returns {boolean} True if the browser is Firefox.
*/
export function isFirefox() {
return navigator.userAgent.toLowerCase().includes('firefox');
}
/**
* Detect if the browser is Chrome.
* @returns {boolean} True if the browser is Chrome.
*/
export function isChrome() {
return navigator.userAgent.toLowerCase().includes('chrome') &&
!navigator.userAgent.toLowerCase().includes('edge') &&
!navigator.userAgent.toLowerCase().includes('opera');
} |
we can define isfirefox there in a line, maybe no need for browserUtils.js there has been an extra option added for firefox #323 , so not a good idea to delete the branch |
Description
Related Issues
Checklist