Changeset 7786

Show
Ignore:
Timestamp:
03/25/07 17:51:55 (22 months ago)
Author:
bill
Message:

make tooltip a bubble, and trigger it from position of node rather than position of mouse, for accessibility reasons.
refs #2639

Location:
dijit/trunk
Files:
1 added
3 modified

Legend:

Unmodified
Added
Removed
  • dijit/trunk/tests/test_Tooltip.html

    r7562 r7786  
    2020                 
    2121                /* override tooltip style for this page */ 
    22                 body .dojoTooltip { color: blue; border: solid 2px blue; padding: 4px; } 
    23                  
     22 
     23                body .dojoTooltipContainer { color: blue; border: solid 2px blue; padding: 4px; } 
     24                body .dojoTooltip .dojoTooltipConnector { border-bottom-color: blue; } 
     25 
    2426                /* and then have some tooltips that look different than the others (just for testing) */ 
    2527                body .waves { color: red; font-style: italic; background: url(images/2.jpg) top right; border: red 3px dotted;} 
  • dijit/trunk/themes/tundra/tundra.css

    r7686 r7786  
    399399 
    400400.dojoTooltip { 
    401         border: solid black 1px; 
    402         background: beige; 
     401        position: absolute; 
     402        z-index: 10; 
     403        display: block; 
     404        margin-top: 10px; 
     405        border: red; 
     406        /* todo: make visible but off screen */ 
     407} 
     408 
     409.dojoTooltipContainer { 
     410        border: solid black 2px; 
     411        background: #b8b5b5; 
    403412        color: black; 
    404         position: absolute; 
    405413        font-size: small; 
    406414        padding: 2px 2px 2px 2px; 
    407         z-index: 10; 
    408         display: block; 
     415} 
     416 
     417.dojoTooltipConnector { 
     418        /* the border on the triangle */ 
     419        font-size: 0px; line-height: 0%; width: 0px; 
     420        position: absolute; 
     421        border-top: none; 
     422        border-bottom: 14px solid black; 
     423        border-left: 7px solid transparent; 
     424        border-right: 7px solid transparent; 
     425        top: -14px; 
     426        left: 3px; 
     427        z-index: 2; 
     428} 
     429 
     430.dojoTooltipConnector div { 
     431        /* the background of the triangle */ 
     432        font-size: 0px; line-height: 0%; width: 0px; 
     433        position: absolute; 
     434        border-bottom: 10px solid #b8b5b5; 
     435        border-left: 5px solid transparent; 
     436        border-right: 5px solid transparent; 
     437        top: 6px; 
     438        left: -5px; 
     439        z-index: 3; 
    409440} 
    410441 
  • dijit/trunk/Tooltip.js

    r7562 r7786  
    88 
    99dojo.require("dijit.base.Widget"); 
     10dojo.require("dijit.base.TemplatedWidget"); 
    1011dojo.require("dijit.util.PopupManager"); 
    1112 
    1213dojo.declare( 
    1314        "dijit.Tooltip", 
    14         [dijit.base.Widget], 
     15        [dijit.base.Widget, dijit.base.TemplatedWidget], 
    1516        { 
    1617                // summary 
     
    3738                connectId: "", 
    3839 
     40                templatePath: dojo.uri.moduleUri("dijit", "templates/Tooltip.html"), 
     41         
    3942                postCreate: function(){ 
    4043                        this._connectNode = dojo.byId(this.connectId); 
     
    4245 
    4346                        if(this.caption != ""){ 
    44                                 this.domNode.appendChild(document.createTextNode(this.caption)); 
     47                                this.containerNode.appendChild(document.createTextNode(this.caption)); 
    4548                        } 
    46                         dojo.html.addClass(this.domNode, "dojoTooltip"); 
    4749                }, 
    4850 
    4951                _onMouseOver: function(/*Event*/ e){ 
    50                         this._mouse = {pageX: e.pageX, pageY: e.pageY, target: e.target}; 
    51  
    5252                        // Start tracking mouse movements, so we know when to cancel timers or erase the tooltip 
    5353                        if(!this._tracking){ 
     
    6060 
    6161                _onMouseMove: function(/*Event*/ e) { 
    62                         this._mouse = {pageX: e.pageX, pageY: e.pageY, target: e.target}; 
    63  
    6462                        if(dojo.html.overElement(this._connectNode, e) || dojo.html.overElement(this.domNode, e)){ 
    6563                                this._onHover(e); 
     
    113111 
    114112                        if (this.isShowingNow) { return; } 
    115                         dijit.util.PopupManager.open(this._mouse, this, [10,15]); 
     113                        dijit.util.PopupManager.openAround(this._connectNode, this, {'BL': 'TL', 'TL': 'BL'}, [0, 0] ); 
    116114                        this.isShowingNow = true; 
    117115                },