mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
fixes bug with keyboard input in click tooltips
Co-Authored-By: David Wilson <daviwil@users.noreply.github.com>
This commit is contained in:
@@ -153,11 +153,10 @@ class TooltipManager {
|
||||
}
|
||||
|
||||
window.addEventListener('resize', hideTooltip)
|
||||
window.addEventListener('keydown', hideTooltip, { capture: true })
|
||||
|
||||
const disposable = new Disposable(() => {
|
||||
window.removeEventListener('resize', hideTooltip)
|
||||
window.removeEventListener('keydown', hideTooltip, { capture: true })
|
||||
|
||||
hideTooltip()
|
||||
tooltip.destroy()
|
||||
|
||||
|
||||
@@ -82,6 +82,7 @@ Tooltip.prototype.init = function (element, options) {
|
||||
var eventIn, eventOut
|
||||
|
||||
if (trigger === 'hover') {
|
||||
this.hideOnKeydownOutsideOfTooltip = () => this.hide()
|
||||
if (this.options.selector) {
|
||||
eventIn = 'mouseover'
|
||||
eventOut = 'mouseout'
|
||||
@@ -220,6 +221,10 @@ Tooltip.prototype.show = function () {
|
||||
window.addEventListener('click', this.hideOnClickOutsideOfTooltip, true)
|
||||
}
|
||||
|
||||
if (this.hideOnKeydownOutsideOfTooltip) {
|
||||
window.addEventListener('keydown', this.hideOnKeydownOutsideOfTooltip, true)
|
||||
}
|
||||
|
||||
var tip = this.getTooltipElement()
|
||||
this.startObservingMutations()
|
||||
var tipId = this.getUID('tooltip')
|
||||
@@ -359,6 +364,10 @@ Tooltip.prototype.hide = function (callback) {
|
||||
window.removeEventListener('click', this.hideOnClickOutsideOfTooltip, true)
|
||||
}
|
||||
|
||||
if (this.hideOnKeydownOutsideOfTooltip) {
|
||||
window.removeEventListener('keydown', this.hideOnKeydownOutsideOfTooltip, true)
|
||||
}
|
||||
|
||||
this.tip && this.tip.classList.remove('in')
|
||||
this.stopObservingMutations()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user