-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Make legend toggle work in IE11 #2741
Make legend toggle work in IE11 #2741
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2741 +/- ##
==========================================
- Coverage 82.85% 82.82% -0.03%
==========================================
Files 60 60
Lines 4776 4791 +15
==========================================
+ Hits 3957 3968 +11
- Misses 819 823 +4
Continue to review full report at Codecov.
|
@GDFaber Thank you for looking into this. The change looks almost good, but we'd like to minimize the effect of change. So can you add the conditional like the below instead of just changing to 'block'?
|
Hi @kt3k, sure, I'll add IE detection as stated above. I have a question about that: I found a check for IE9 in clip.js/ChartInternal.prototype.getClipPath() as well. Should I add a detection function to util.js (as a part of this PR) and let getClipPath() use it (this would be a new PR then)? or is it ok to just check locally and leave clip.js as it is? |
That sounds good to me. |
|
src/util.js
Outdated
*/ | ||
export var getIEVersion = function() { | ||
// https://stackoverflow.com/questions/19999388/check-if-user-is-using-ie | ||
const agent = window.navigator.userAgent; |
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.
How about taking agent
as function paramter? If we do so, we can write the tests like the below:
expect(getIEVersion('Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko ')).toBe(11)
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.
Sure, let's do this. I'm going to modify getIEVersion() to take an optional parameter so usage is kept simple and it can be tested as well.
@@ -10,7 +11,7 @@ Chart.prototype.show = function (targetIds, options) { | |||
targets = $$.svg.selectAll($$.selectorTargets(targetIds)); | |||
|
|||
targets.transition() | |||
.style('display', 'initial', 'important') | |||
.style('display', isIE() ? 'block' : 'initial', 'important') |
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.
nice!
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.
@GDFaber LGTM. Thank you for the contribution!
display: initial
bydisplay: block
in Chart.prototype.show() to stop hidden data items from disappearing in IE11 when they should be shown again (as described in IE 11 legend toggle #2528).