Changeset 14510

Show
Ignore:
Timestamp:
07/18/08 11:04:30 (4 months ago)
Author:
becky
Message:

fixes #7185 If a title attribute has been provided on a button, do not set the label as the title when showLabel=false. This does not affect the screen reader since it does not speak the title it speaks the label. The label is provided to the screen reader via the ARIA labelledby property which points to the node with the label text.

Location:
dijit/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • dijit/trunk/form/Button.js

    r14272 r14510  
    6868                //      get label and set as title on button icon if necessary 
    6969                if (this.showLabel == false){ 
    70                         var labelText = ""; 
    7170                        this.label = this.containerNode.innerHTML; 
    72                         labelText = dojo.trim(this.containerNode.innerText || this.containerNode.textContent || ''); 
    73                         // set title attrib on iconNode 
    74                         this.titleNode.title=labelText; 
     71                        // if no title provided, set title attrib on iconNode 
     72                        if(!dojo.attr(this.domNode, "title")){ 
     73                                this.titleNode.title=dojo.trim(this.containerNode.innerText || this.containerNode.textContent || ''); 
     74                        } 
    7575                        dojo.addClass(this.containerNode,"dijitDisplayNone"); 
    7676                } 
     
    9393                this.containerNode.innerHTML = this.label = content; 
    9494                this._layoutHack(); 
    95                 if (this.showLabel == false){ 
     95                if (this.showLabel == false && !(dojo.attr(this.domNode, "title"))){ 
    9696                        this.titleNode.title=dojo.trim(this.containerNode.innerText || this.containerNode.textContent || ''); 
    9797                } 
  • dijit/trunk/tests/form/test_Button.html

    r13943 r14510  
    9898        <br clear="all"> 
    9999        <h2>Buttons with no text label</h2> 
    100         <p>Buttons have showLabel=false so text is not displayed.  Should have title attribute displayed on mouse over</p> 
    101         <div class="box"> 
    102                 <button id="1466" dojoType="dijit.form.Button" onClick='console.log("clicked simple button with no text label")'  
     100        <p>Buttons have showLabel=false so text is not displayed.  If no title attribute supplied, Should have label as title attribute displayed on mouse over</p> 
     101        <div class="box"> 
     102                <button id="1466" dojoType="dijit.form.Button" title="title attrib rather than label" onClick='console.log("clicked simple button with no text label")'  
    103103                iconClass="plusIcon" showLabel="false"> 
    104104                <span><b>Rich</b><i> Text</i> Test!</span>