Closed Bug 130800 Opened 22 years ago Closed 20 years ago

HTML button 'forgets' its js set position when clicked


(Core :: Layout: Form Controls, defect, P2)

Windows 95





(Reporter: bugzilla.t.jvance, Assigned: john)




(Keywords: testcase)


(1 file)

Paste the following html/javascript into a web page.  Clicking on the button
moves the button to the right two or three times, and then stops.  Sometimes
after several minutes, an additional click will move the button one more time.

When the onclick fails to fire, pressing and holding the mouse button down makes
the button appear depressed, and in a previous position (50 or 100 pixels to the
left.)  Releasing the mouse button returns the button to its current position.

Pressing the enter key consistently steps the button to the right.

This is particularly embarrassing because the demo code was found in a 
Netscape 6 tutorial! 

<!-- begin sample code -->
<INPUT ID="counter1" STYLE="position:relative; left:0px" TYPE="button"
VALUE="Move Button" 
var obj = document.getElementById('counter1');
var xlocation = parseInt(;
function handleClick() {
  xlocation += 50;
  document.getElementById('counter1').style.left = xlocation + "px";
// -->
<!-- end sample code -->

Expected behavior:
Mouse click should march the button in 50 pixel steps to the right indefinitely.
Works in IE 5.5

Platforms/builds tested:
0.9.9 Win 95

20020217 Sparc Solaris
Over to DOM Events.
Assignee: jst → joki
Component: DOM Level 0 → DOM Events
QA Contact: desale → vladimire
Attached file Reporters Example
Confirming bug, but there is nothing wrong with the click event. The problem
seems to be that when the HTML button is depressed it temporarily moves back to
its original location. If this location moves it out from under the cursor then
the mouseup event doesn't happen on the HTML button, and hence the _click_
event naturally doesn't either. 

Also attaching reporters example.
Confirming and changing Summary. 
Ever confirmed: true
Summary: Mouse left-click does not appear to fire button's onclick event consistently → HTML button 'forgets' its js set position when clicked
Confirming button behavior

Click and hold mouse button down, and the HTML button jumps to the left.  If the
HTML button jumps out from underneath the mouse cursor, the onClick does not fire.

If, while holding the mouse button down, you move the mouse, the button jumps
back.  Releasing the mouse button over the HTML button fires the event.

Is this still DOM Event or is it something else?
This is wierd! Works fine on mac 7.01 release...
Assignee: joki → jkeiser
Priority: -- → P2
Component: DOM Events → Layout: Form Controls
Still broken on Mozilla 1.3a, Linux.  More strangeness: on depressing the mouse
button, the form button at position b jumps to its original position a.  Move
the mouse one pixel, and the button jumps back to b.  Move the mouse one more
pixel, it jumps to a.  Make little circles with the mouse cursor while the mouse
button is depressed, and the form button flickers back and forth between
position a and b. 
Boris might be interested to see this.  It's a relatively positioned button,
almost certainly an incremental reflow problem.
This almost smells like some cached data is not being cleared out of the 
Boy, the behavior of the button in the testcase was correct in the 6/11/02 trunk
build, but I can reproduce the bug in the 1/08/03 Trunk build in Windows.
Keywords: testcase
Target Milestone: --- → Future
This worksforme in current builds; probably fixed by bug 171830 
Closed: 20 years ago
Depends on: 171830
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.