Closed
Bug 145577
Opened 22 years ago
Closed 22 years ago
scrollHeight/scrollTop not supported correctly on textareas
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
People
(Reporter: erik, Assigned: keeda)
References
Details
(Keywords: testcase)
Attachments
(3 files, 2 obsolete files)
(deleted),
text/html
|
Details | |
(deleted),
text/html
|
Details | |
(deleted),
patch
|
john
:
review+
keeda
:
superreview+
|
Details | Diff | Splinter Review |
The scroll model inside html textareas is broken. The return value for
scrollHeight returns incorrectly always the same value as the height of the
textarea.
This is a severe loss of functionality because teh ability to control the size
and scrolling of textareas is maybe even more important than for other elements.
I know that the scroll model is very buggy in general but it is totally broken
for textareas. This is not acceptable.
Reporter | ||
Comment 1•22 years ago
|
||
When you write something (onkeypress) the window.status is updated with the
current scrollHeight value. The value is always 300 which is obviously
incorrect.
Comment 2•22 years ago
|
||
I confirm that scrollHeight and scrollWidth properties do not get updated at all
(window XP, Moz1.1a+ build 20020707).
The properties clientHeight and clientWidth are also ignored on textarea
elements as they show 0.
The properties offsetHeight and offsetWidth are also quite wrong: they do not
include padding and border values on the textarea.
The properties clientLeft and clientTop are undefined for textarea (not just
specific to textarea but to all elements: see bug 62536 and 11207 on that).
Setting and/or getting scrollLeft and/or scrollTop values to a textarea also do
not work.
So, at least 6 DHTML object model properties do not work at all on textarea.
"Severe loss of functionality", "very buggy" and "totally broken" words are
reasonable and level-headed here. A complete test case will follow later (within
a few days).
Comment 3•22 years ago
|
||
Self explanatory meta test case for textarea elements.
Comment 4•22 years ago
|
||
In light of what was agreed on in bug 157847, then the offsetWidth and
offsetHeight property values are correctly, accordingly computed as they include
padding and border values of the textarea.
Comment 5•22 years ago
|
||
Having these properties actually work for textareas is crucial.
Comment 6•22 years ago
|
||
jst, we would get the scroll offsets for a multiline text control from nsIView
right?
--pete
Updated•22 years ago
|
Keywords: mozilla1.3
Updated•22 years ago
|
Summary: scrollHeight not supported on textareas → scrollHeight/scrollTop not supported correctly on textareas
Comment 7•22 years ago
|
||
Is this going to be fixed?
I actually have a requirement for a page I am doing to return the user to a spot
in the textarea some ways down from the top after a submit.
Since even moving the caret position does not change the viewable part of the
textarea (and there is no way to simulate a keypress event), the best I can do
is create a button that says "go to last position" that restores the caret
position and then alert the user telling them to "push an arrow key"...
Updated•22 years ago
|
Attachment #91600 -
Attachment is obsolete: true
Comment 8•22 years ago
|
||
I added wrap="off" so that an horizontal scrollbar may appear in Mozilla, MSIE
6 for Windows and Opera 7. I tuned the previous testcase.
The red-bordered and yellow background colored textarea can be edited at will
to add, remove, append, delete,.. whatever content, typing in order to
display/remove scrollbar(s) at will. The affected DHTML property values will
(rather should) be updated in real time.
Updated•22 years ago
|
Keywords: mozilla1.3
Assignee | ||
Comment 10•22 years ago
|
||
This appears to make things much better. Is this really as simple as this?
I dont know enough about views to be sure.
Assignee | ||
Comment 11•22 years ago
|
||
Comment on attachment 120974 [details] [diff] [review]
Possible fix ?
jst, jkeiser, what do you think?
Attachment #120974 -
Flags: superreview?(jst)
Attachment #120974 -
Flags: review?(jkeiser)
Comment 12•22 years ago
|
||
Comment on attachment 120974 [details] [diff] [review]
Possible fix ?
if (!scrollFrame) {
+
Loose the empty line here.
+ nsIScrollableViewProvider *scrollProvider = nsnull;
+ CallQueryInterface(frame, &scrollProvider);
+ if (scrollProvider) {
+ scrollProvider->GetScrollableView(presContext, aScrollableView);
+ return NS_OK;
+ }
+
Yeah, that looks good to me, but what if the scrollable view provider doesn't
provide a view (i.e. returns null)? IMO we should only return early here if
*aScrollableView is non-null, if not, fall through to the other code.
sr=jst with those changes.
Attachment #120974 -
Flags: superreview?(jst) → superreview+
Assignee | ||
Comment 14•22 years ago
|
||
Attachment #120974 -
Attachment is obsolete: true
Assignee | ||
Comment 15•22 years ago
|
||
Comment on attachment 121113 [details] [diff] [review]
Fixed jst's issues
Marking jst's sr. John, can you review this fairly simple patch.
Attachment #121113 -
Flags: superreview+
Attachment #121113 -
Flags: review?(jkeiser)
Assignee | ||
Comment 16•22 years ago
|
||
Comment on attachment 120974 [details] [diff] [review]
Possible fix ?
Ugh :-( When is bugzilla going to learn to cancel review requests on obsoleted
patches?
Attachment #120974 -
Flags: review?(jkeiser)
Comment 17•22 years ago
|
||
Comment on attachment 121113 [details] [diff] [review]
Fixed jst's issues
oh, now I get it. r=jkeiser. Perhaps the body element should implement this
as well, eh ...
Attachment #121113 -
Flags: review?(jkeiser) → review+
Assignee | ||
Comment 18•22 years ago
|
||
Checked in. -> Fixed.
I'm sure that there are still some problems with the scroll model, but
hopefully things should now be only as bad as for any other element :-)
(This may fix at least a couple of other bugs, ill go through and check them
later.)
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
Comment 19•22 years ago
|
||
Iframe with designMode(midas) on has the same problem. Will this also fix that
too? This fix is not just for textarea right?
Comment 20•22 years ago
|
||
For your information, Editable IFrame still doesnt have the scrollWidth
working.
Comment 21•22 years ago
|
||
This bug was about scrollHeight in textareas, can you file a new bug about the
midas problem?
Updated•12 years ago
|
Component: DOM: Mozilla Extensions → DOM
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•