Opened 14 years ago

Closed 14 years ago

Last modified 11 years ago

#7185 closed defect (fixed)

Button: overwrites "title" attribute if "showLabel" is false

Reported by: Malte Randt Owned by: Becky Gibson
Priority: high Milestone: 1.2
Component: Dijit - Form Version: 1.1.1
Keywords: button label title tooltip Cc: [email protected]…, Becky Gibson
Blocked By: Blocking:


Button overwrites the attribute "title" if "showLabel" is set to false. I suppose this is a defect in method "postCreate".

Example (tested on FF3.0 and IE7.0):

var button = new dijit.form.Button(
    title: "myTitle",
    iconClass: "myIconClass",
    label: "myLabel",
    showLabel: false

This will create a button showing the title "myLabel" rather than "myTitle".

Background: I'd like to create a button (placed on a toolbar) which has both an icon and a label. Depending on the user's preferences, I will disable or enable showLabel.

I will also have a tooltip connected to the button, therefore I want the title tag to be empty - otherwise the browser would display the title alongside the Dojo tooltip.

Possible solution:

1.) Only overwrite title in method postCreate if title is undefined (fix defect) 2.) Enhance dijit.form.Button by "showTitle" property and interpret this accordingly (enhancement)

Change History (6)

comment:1 Changed 14 years ago by bill

Cc: Becky Gibson added

I understand your issue.

I think we are doing that for a11y reasons, so that screen readers know what to speak (like to say "cut" for the picture of a pair of scissors). Seems related/the same as #3876. Becky, can you comment?

comment:2 Changed 14 years ago by Douglas Hays

Owner: set to Becky Gibson

see also #3876

comment:3 Changed 14 years ago by Becky Gibson

Milestone: tbd1.2

comment:4 Changed 14 years ago by Becky Gibson

Resolution: fixed
Status: newclosed

(In [14510]) 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.

comment:5 Changed 14 years ago by bill

Summary: dijit.form.Button overwrites "title" attribute if "showLabel" is falseButton: overwrites "title" attribute if "showLabel" is false

Note: base ticket was #3815.

comment:6 Changed 11 years ago by bill

Component: DijitDijit - Form
Note: See TracTickets for help on using tickets.