Skip to content

Commit 4be7d99

Browse files
pastcomputemcwhittemore
authored andcommitted
event.srcElement has limited support so fall back to event.target (#752)
* event.srcElement has limited support so fall back to event.target * add fix to changelog
1 parent 59e6253 commit 4be7d99

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 1.0.6
2+
3+
- Fixes bug where event.srcElement is not defined in Firefox [#752](https://github.com/mapbox/mapbox-gl-draw/pull/752) via [@pastcompute](https://github.com/pastcompute)
4+
15
## 1.0.5
26

37
- update browserify to version 15.0.0 [#731](https://github.com/mapbox/mapbox-gl-draw/pull/731)

src/events.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ module.exports = function(ctx) {
127127
const isKeyModeValid = (code) => !(code === 8 || code === 46 || (code >= 48 && code <= 57));
128128

129129
events.keydown = function(event) {
130-
if (event.srcElement.classList[0] !== 'mapboxgl-canvas') return; // we only handle events on the map
130+
if ((event.srcElement || event.target).classList[0] !== 'mapboxgl-canvas') return; // we only handle events on the map
131131

132132
if ((event.keyCode === 8 || event.keyCode === 46) && ctx.options.controls.trash) {
133133
event.preventDefault();

0 commit comments

Comments
 (0)