Skip to content

Commit 5353e31

Browse files
committed
fix: be able to handle clicking a geocoded location in IE11
1 parent d62485d commit 5353e31

File tree

2 files changed

+31
-4
lines changed

2 files changed

+31
-4
lines changed

lib/components/form/location-field.js

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { distanceStringImperial } from '../../util/distance'
1919
import getGeocoder from '../../util/geocoder'
2020
import { formatStoredPlaceName } from '../../util/map'
2121
import { getActiveSearch, getShowUserSettings } from '../../util/state'
22+
import { isIE } from '../../util/ui'
2223

2324
class LocationField extends Component {
2425
static propTypes = {
@@ -518,10 +519,27 @@ function createOption (icon, title, onSelect, isActive, isLast) {
518519
// style={{ borderBottom: '1px solid lightgrey' }}
519520
key={itemKey++}
520521
active={isActive}>
521-
<div style={{ paddingTop: '5px', paddingBottom: '3px' }}>
522-
<div style={{ float: 'left' }}><i className={`fa fa-${icon}`} /></div>
523-
<div style={{ marginLeft: '30px', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>{title}</div>
524-
</div>
522+
{isIE()
523+
// In internet explorer 11, some really weird stuff is happening where it
524+
// is not possible to click the text of the title, but if you click just
525+
// above it, then it works. So, if using IE 11, just return the title text
526+
// and avoid all the extra fancy stuff.
527+
// See https://github.com/ibi-group/trimet-mod-otp/issues/237
528+
? title
529+
: (
530+
<div style={{ paddingTop: '5px', paddingBottom: '3px' }}>
531+
<div style={{ float: 'left' }}><i className={`fa fa-${icon}`} /></div>
532+
<div style={{
533+
marginLeft: '30px',
534+
overflow: 'hidden',
535+
textOverflow: 'ellipsis',
536+
whiteSpace: 'nowrap'
537+
}}>
538+
{title}
539+
</div>
540+
</div>
541+
)
542+
}
525543
</MenuItem>
526544
}
527545

lib/util/ui.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import bowser from 'bowser'
2+
13
import { MainPanelContent } from '../actions/ui'
24
import { summarizeQuery } from './query'
35
import { getActiveSearch } from './state'
@@ -10,6 +12,13 @@ export function isMobile () {
1012
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)
1113
}
1214

15+
/**
16+
* Returns true if the user is using a [redacted] browser
17+
*/
18+
export function isIE () {
19+
return bowser.name === 'Internet Explorer'
20+
}
21+
1322
/**
1423
* Enables scrolling for a specified selector, while disabling scrolling for all
1524
* other targets. This is adapted from https://stackoverflow.com/a/41601290/915811

0 commit comments

Comments
 (0)