The following code does not reset the vertical scrollbar after a page changed to a smaller height.
It's reproducible:
I guess there must be a setting that I'm missing.
Any idea? Thank you!
import gi
gi.require_version('Gtk', '3.0')
gi.require_version('WebKit', '3.0')
from gi.repository import Gtk, WebKit, GLib, Gdk
if __name__ == '__main__':
URL = 'http://google.com'
browser = WebKit.WebView()
browser.load_uri(URL)
win = Gtk.Window()
swin = Gtk.ScrolledWindow()
swin.add_with_viewport(browser)
swin.set_hexpand(True)
swin.set_vexpand(True)
swin.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
win.add(swin)
win.fullscreen()
win.show_all()
Gtk.main()
Question: WebKit: scrollbar height not reset after page change
Using
swin.add_with_viewport(browser)
This will be very wrong for most widgets that support native scrolling, use instead
swin.add(browser)
Gtk.ScrolledWindow.add_with_viewport(child)
Deprecated since version 3.8:
Gtk.Container.add()
will automatically add aGtk.Viewport
if the child doesn’t implementGtk.Scrollable
.