MCPcopy Index your code
hub / github.com/codecombat/codecombat / trapFocus

Method trapFocus

app/views/core/ModalView.js:91–102  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

89 }
90
91 trapFocus () {
92 if (!this.trapsFocus) { return }
93 if (!this.focusTrap) {
94 this.focusTrap = focusTrap.createFocusTrap(this.el)
95 }
96 try {
97 this.focusTrap?.activate()
98 console.log(this.constructor?.name, 'trapping focus within modal')
99 } catch (e) {
100 console.log(this.constructor?.name, 'not trapping focus for modal with no focusable elements')
101 }
102 }
103
104 showLoading ($el) {
105 if (!$el) { $el = this.$el.find('.modal-body') }

Callers 1

renderMethod · 0.95

Calls 1

logMethod · 0.80

Tested by

no test coverage detected