Open
Bug 642399
Opened 15 years ago
Updated 5 years ago
Focus on input control having default value doesn't work
Categories
(Core :: DOM: Editor, defect, P5)
Tracking
()
NEW
People
(Reporter: vasanthg, Unassigned)
References
(Depends on 1 open bug)
Details
(Keywords: testcase)
Attachments
(1 file)
|
1.28 KB,
text/html
|
Details |
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534.25 (KHTML, like Gecko) Chrome/12.0.703.0 Safari/534.25
Build Identifier: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0) Gecko/20100101 Firefox/4.0
Create a 'input' element with some default value like 'Type your text'. Add 'mousedown' and 'blur' events to the control. On mousedown, clear the default text and set focus. On blur set back the default text.Now,if viewed in Firefox 4 RC1, the control is not getting focus if we click on top of the default text.Only by clicking just before or after 'Type your text',the control gets focus.
Reproducible: Always
Steps to Reproduce:
1.Create a HTM page with the following contents.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script type="text/javascript">
var inputTextElement;
var isIE;
function onInit()
{
isIE = window.navigator.appVersion.match(/MSIE (\d+)/) != null;
inputTextElement = document.getElementById("inputText");
inputTextElement.value = " Type your Text" ;
addDOMListener(inputTextElement, "onmousedown", initializeFocus);
addDOMListener(inputTextElement, "onblur", blurFocus);
}
function addDOMListener(element, eventType, handler)
{
if(isIE)
{
element.attachEvent(eventType, handler);
element.attachEvent(eventType, handler);
}
else
{
element.addEventListener(eventType.substr(2), handler, false);
element.addEventListener(eventType.substr(2), handler, false);
}
}
function initializeFocus(eventObject)
{
if(inputTextElement.value == " Type your Text")
inputTextElement.value = "";
inputTextElement.focus();
}
function blurFocus(eventObject)
{
if(inputTextElement.value == "")
{
inputTextElement.value = " Type your Text" ;
}
}
</script>
</head>
<body onload="onInit();" style="text-align:center;top:50px">
<input id="inputText" type="text" title="Type your Text"/>
</body>
</html>
2.Now Open the page in Firefox 4 RC1.
3.Click on top of 'Type your text'.Nothing happens.
4.Click just before or after 'Type your text'.The control gets focus.
Actual Results:
Click on top of 'Type your text'.Nothing happens.
Click just before or after 'Type your text'.The control gets focus.
Expected Results:
Clicking on top of 'Type your text', The control should get focus and the text should be cleared.
It's working fine in Chrome 11,IE8,IE9, Firefox 3.6.15. But fails in Firefox 4 RC1.
Comment 2•15 years ago
|
||
The problem is the mousedown handler, I would assume. We had a similar bug report recently... Timothy, is this the same issue?
Comment 3•15 years ago
|
||
(In reply to comment #2)
> The problem is the mousedown handler, I would assume. We had a similar bug
> report recently... Timothy, is this the same issue?
You're talking about bug 641598?
Comment 5•15 years ago
|
||
> You're talking about bug 641598?
Yes.
Comment 6•5 years ago
|
||
Bulk-downgrade of unassigned, >=5 years untouched DOM/Storage bugs' priority.
If you have reason to believe this is wrong (especially for the severity), please write a comment and ni :jstutte.
Severity: major → S4
Priority: -- → P5
You need to log in
before you can comment on or make changes to this bug.
Description
•