Skip to content

Commit 357ae78

Browse files
pdanpdanrstoenescu
authored andcommitted
fix(ie): Guard document.activeElement for null (quasarframework#5106)
1 parent 16a0b12 commit 357ae78

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

ui/src/components/dialog/QDialog.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,8 @@ export default Vue.extend({
184184
this.__showPortal()
185185

186186
if (this.noFocus !== true) {
187-
document.activeElement.blur()
187+
// IE can have null document.activeElement
188+
document.activeElement !== null && document.activeElement.blur()
188189
this.__nextTick(this.focus)
189190
}
190191

ui/src/components/field/QField.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,10 @@ export default Vue.extend({
195195

196196
blur () {
197197
const el = document.activeElement
198-
this.$el.contains(el) && el.blur()
198+
// IE can have null document.activeElement
199+
if (el !== null && this.$el.contains(el)) {
200+
el.blur()
201+
}
199202
},
200203

201204
__focus () {

ui/src/components/menu/QMenu.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,8 @@ export default Vue.extend({
134134

135135
this.$el.dispatchEvent(create('popup-show', { bubbles: true }))
136136

137-
if (this.noFocus !== true) {
137+
// IE can have null document.activeElement
138+
if (this.noFocus !== true && document.activeElement !== null) {
138139
document.activeElement.blur()
139140
}
140141

0 commit comments

Comments
 (0)