Closed
Bug 285005
Opened 19 years ago
Closed 19 years ago
need scrollbox with scrollbars (like overflow: auto)
Categories
(Core :: XUL, enhancement)
Core
XUL
Tracking
()
RESOLVED
FIXED
People
(Reporter: ckspencer, Assigned: neil)
Details
Attachments
(1 file)
1.11 KB,
patch
|
roc
:
review+
roc
:
superreview+
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0 Setting the style of a scrollbox to overflow: auto; does not produce a scrollbar. This is extremely inconvenient since the scrollbox is apparently the only element whose scroll position is programmatically accessible via javascript. In other words, with any other scrollable element, the user can control the scroll position, but not a script, and with the scrollbox, the script can control the scroll position, but not the user. The following XUL code will create a textbox which will capture the enter key and paste text into a vertically-oriented scrollbox. Notice that when the text begins to overflow, the scroll box is scrolled, but no scrollbars appear even though the scrollbox style is explicitly set to overflow: auto; <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin" type="text/css"?> <window title="Console" xmlns:html="http://www.w3.org/1999/xhtml" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <html:script> //<![CDATA[ function enter_text(e){ // Takes text from input and displays in output. inp = document.getElementById('input_text'); if (inp.value.length && e.keyCode == 13){ outp = document.getElementById('output_text'); text = document.createElementNS('http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul', 'description'); text.appendChild(document.createTextNode(inp.value)); outp.appendChild(text); inp.value = ''; repos('output_text') } } function repos(baseid) { var scrollBoxObject = document.getElementById(baseid).boxObject.QueryInterface(Components.interfaces.nsIScrollBoxObject); scrollBoxObject.scrollByIndex(9999999); } //]]> </html:script> <groupbox flex="1" > <scrollbox id="output_text" flex="1" orient="vertical" style='overflow: auto;'> </scrollbox> <textbox id="input_text" flex="0" /> </groupbox> <html:script> //<![CDATA[ // setup event handlers inp = document.getElementById('input_text'); inp.addEventListener("keypress", enter_text, false); inp.focus(); //]]> </html:script> </window> Reproducible: Always
Updated•19 years ago
|
Assignee: firefox → jag
Component: General → XP Toolkit/Widgets
Product: Firefox → Core
QA Contact: general → jrgmorrison
Version: unspecified → 1.0 Branch
Comment 1•19 years ago
|
||
no duplicates found -> NEW See also: http://groups-beta.google.com/group/netscape.public.dev.xul/browse_frm/thread/d319e7bbfa6d908/c560067ebe6a76d1?tvc=1#c560067ebe6a76d1 As Neil pointed out, this is by design for <scrollbox>, so I'm changing the bug to ask for a widget that has nsIScrollBoxObject methods *and* automatic scrollbars. This can easily be done by changing overflow value for that widget from hidden to something else. I think it should be something like <scrollbox scrollbars="true"/> with the following implementation in xul.css: scrollbox { -moz-binding: url("chrome://global/content/bindings/scrollbox.xml#scrollbox"); } scrollbox:not([scrollbars="true"]) { overflow: hidden !important; } scrollbox[scrollbars="true"] { overflow:auto; /* This should not be !important */ -moz-box-flex: 1; /* this is needed so that the scrollbox doesn't grow larger than containing element */ } As far as I can tell, it may help fixing bug 235203 (but I can't be sure there isn't an easier way).
Severity: normal → enhancement
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Windows 2000 → All
Hardware: PC → All
Summary: Scrollbox has no scrollbar → need scrollbox with scrollbars (like overflow: auto)
Version: 1.0 Branch → Trunk
Assignee | ||
Comment 2•19 years ago
|
||
roc, this could be popular, would you be ok with this change?
Comment 3•19 years ago
|
||
I think providing a scrolling API for all elements would be better in the long run. Or at least just for those with an overflow set. How feasible would it be to make element.boxObject return a scrollBoxObject for those things with a scrolling view? Hmmm. nsIScrollBoxObject isn't a subinterface of nsIBoxObject though.
(In reply to comment #2) > roc, this could be popular, would you be ok with this change? I've said several times that I'd be fine with making scrollbox be just 'overflow:hidden' so that can be overridden by authors. (In reply to comment #3) > I think providing a scrolling API for all elements would be better in the long > run. Or at least just for those with an overflow set. > > How feasible would it be to make element.boxObject return a scrollBoxObject > for those things with a scrolling view? Hmmm. nsIScrollBoxObject isn't a > subinterface of nsIBoxObject though. That won't work as soon as you want to use scrollBoxObject properties on any element which has its own special boxObject. It's probably easier to leave things as they are. For now anyway.
Assignee | ||
Comment 5•19 years ago
|
||
I'm not disputing that you've mentioned it before I just haven't known of anywhere to point at before.
Assignee: jag → neil.parkwaycc.co.uk
Status: NEW → ASSIGNED
Attachment #178923 -
Flags: superreview?(roc)
Attachment #178923 -
Flags: review?(roc)
Attachment #178923 -
Flags: superreview?(roc)
Attachment #178923 -
Flags: superreview+
Attachment #178923 -
Flags: review?(roc)
Attachment #178923 -
Flags: review+
Assignee | ||
Comment 6•19 years ago
|
||
Fix checked in.
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•