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

RESOLVED WORKSFORME

Status

()

RESOLVED WORKSFORME
10 years ago
10 years ago

People

(Reporter: ole.ersoy, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

10 years ago
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.
(Reporter)

Comment 1

10 years ago
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
Last Resolved: 10 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.