Closed Bug 453745 Opened 16 years ago Closed 16 years ago

Clicking Checkbox Border Triggers onClick Event, But Does Not Checkoff Checkbox

Categories

(Firefox :: General, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: ole.ersoy, Unassigned)

Details

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.16) Gecko/20080715 Fedora/2.0.0.16-1.fc8 Firefox/2.0.0.16
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.16) Gecko/20080715 Fedora/2.0.0.16-1.fc8 Firefox/2.0.0.16

Hi,

I attempted to create a component that wraps a input element that is a checkbox.  The idea was to set checked to false on the component when the checkbox is not checked, and true when it is checked.

The problem is that if someone clicks on the border of the checkbox, the component hears the event and sets checked to true, but the checkbox is not really checked.

It would be great if the default behavior for checkbox nodes would be to checkoff the checkbox whenever any area of the dom node that is the checkbox is clicked.

Reproducible: Always

Steps to Reproduce:
1.Create a checkbox
2.Hook up a onclick listener
3.Click the border of the checkbox
Actual Results:  
The onclick listener will get triggered, even though the checkbox is not checked

Expected Results:  
The checkbox should be checked off, since an area of it's dom node was clicked.
OK - I was able to work it out like this:

	handleMouseClickEvent: function(/*Event*/ mouseClickEvent)
	{
		var component = mouseClickEvent.componentReference;
		if (mouseClickEvent.target.checked)
		{
			component.checked = mouseClickEvent.target.checked;
		}
		else if (mouseClickEvent.target.checked == false)
		{
			component.checked = mouseClickEvent.target.checked;
		}
		console.debug("isChecked: " + this.isChecked());
	}
Status: UNCONFIRMED → RESOLVED
Closed: 16 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.