Skip to content

Commit

Permalink
Don't render map icons in IE 11 (#55848)
Browse files Browse the repository at this point in the history
As reported in #55184, the service map is completely broken in IE. This is because IE has some bugs around SVG that cause a runtime error.

This change detects IE 11 and does not render those problematic icons.

The result is a map that has the shapes but no SVG icons in them: https://www.dropbox.com/s/o7hp73yv5klpfqd/Screenshot%202020-01-24%2009.27.54.png?dl=0

We'll follow up in a future release with a fix to show the icons, but this makes it so the map is functional in IE.

Fixes #55184.

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
  • Loading branch information
smith and elasticmachine authored Feb 5, 2020
1 parent f870120 commit 950ddf8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,23 @@ const serviceIcons: { [key: string]: string } = {

export const defaultIcon = getAvatarIcon();

// IE 11 does not properly load some SVGs, which causes a runtime error and the
// map to not work at all. We would prefer to do some kind of feature detection
// rather than browser detection, but IE 11 does support SVG, just not well
// enough for our use in loading icons.
//
// This method of detecting IE is from a Stack Overflow answer:
// https://stackoverflow.com/a/21825207
//
// @ts-ignore `documentMode` is not recognized as a valid property of `document`.
const isIE11 = !!window.MSInputMethodContext && !!document.documentMode;

export function iconForNode(node: cytoscape.NodeSingular) {
const type = node.data('type');
if (type === 'service') {
return serviceIcons[node.data('agentName') as string];
} else if (isIE11) {
return defaultIcon;
} else {
return icons[type];
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 950ddf8

Please sign in to comment.