@@ -51366,9 +51366,47 @@ CUI.Tooltip = (function(superClass) {
5136651366 node: this._element,
5136751367 call: (function(_this) {
5136851368 return function(ev) {
51369+ var hideTimeout, hideWhenMouseout, mouseHoverElement, mouseHoverTooltip;
5136951370 _this.show(ev);
51371+ mouseHoverTooltip = false;
51372+ mouseHoverElement = true;
51373+ hideTimeout = null;
51374+ hideWhenMouseout = function(ev) {
51375+ CUI.clearTimeout(hideTimeout);
51376+ return hideTimeout = CUI.setTimeout({
51377+ ms: _this._hide_ms + 100,
51378+ call: function() {
51379+ if (mouseHoverTooltip || mouseHoverElement) {
51380+ return;
51381+ }
51382+ _this.hide(ev);
51383+ }
51384+ });
51385+ };
51386+ CUI.Events.listen({
51387+ type: ["mouseout", "mouseenter"],
51388+ capture: true,
51389+ node: _this.DOM,
51390+ call: function(ev) {
51391+ mouseHoverTooltip = ev.getType() === "mouseenter";
51392+ if (!mouseHoverTooltip) {
51393+ hideWhenMouseout(ev);
51394+ }
51395+ }
51396+ });
51397+ CUI.Events.listen({
51398+ type: ["mouseout", "mouseenter"],
51399+ capture: true,
51400+ node: _this._element,
51401+ call: function(ev) {
51402+ mouseHoverElement = ev.getType() === "mouseenter";
51403+ if (!mouseHoverElement) {
51404+ hideWhenMouseout(ev);
51405+ }
51406+ }
51407+ });
5137051408 return CUI.Events.listen({
51371- type: ["click", "dblclick", "mouseout" ],
51409+ type: ["click", "dblclick"],
5137251410 capture: true,
5137351411 node: _this._element,
5137451412 only_once: true,
@@ -51387,7 +51425,27 @@ CUI.Tooltip = (function(superClass) {
5138751425 return this.__mouseStillEvent;
5138851426 };
5138951427
51428+ Tooltip.prototype.hide = function() {
51429+ var ref;
51430+ if ((ref = this.__keyUpListener) != null) {
51431+ ref.destroy();
51432+ }
51433+ return Tooltip.__super__.hide.call(this);
51434+ };
51435+
5139051436 Tooltip.prototype.show = function(ev) {
51437+ this.__keyUpListener = CUI.Events.listen({
51438+ type: "keyup",
51439+ node: window,
51440+ capture: true,
51441+ call: (function(_this) {
51442+ return function(_ev) {
51443+ if (_ev.getKeyboardKey() === "Esc") {
51444+ _this.hide();
51445+ }
51446+ };
51447+ })(this)
51448+ });
5139151449 if (this.__static) {
5139251450 Tooltip.__super__.show.call(this, ev);
5139351451 } else {
@@ -51431,6 +51489,7 @@ CUI.Tooltip = (function(superClass) {
5143151489 if (!content || _this.__pane.isDestroyed()) {
5143251490 return dfr.reject();
5143351491 }
51492+ CUI.dom.setAttribute(content, "role", "tooltip");
5143451493 _this.__pane.replace(content, "center");
5143551494 return dfr.resolve();
5143651495 };
@@ -51483,10 +51542,13 @@ CUI.Tooltip = (function(superClass) {
5148351542 };
5148451543
5148551544 Tooltip.prototype.destroy = function() {
51486- var ref;
51487- if ((ref = this.__mouseStillEvent ) != null) {
51545+ var ref, ref1 ;
51546+ if ((ref = this.__keyUpListener ) != null) {
5148851547 ref.destroy();
5148951548 }
51549+ if ((ref1 = this.__mouseStillEvent) != null) {
51550+ ref1.destroy();
51551+ }
5149051552 CUI.Events.ignore({
5149151553 instance: this.__dummyInst
5149251554 });
0 commit comments