Focusable ClampScrollable area

I have some GtkTextView container centered inside AdwClampScrollable

I can move focus from another element by click exactly on GtkTextView column (at the center), but not by click on any other AdwClampScrollable area (at the sides).

Tried to change focusable property, but nothing… is any other option or that’s impossible to move focus on this area?

That’s not gonna work - clampscrollable doesn’t listen for clicks. :focusable just means you can focus it with keyboard (which you absolutely don’t want here unless you want to require an extra Tab to get to the textview)

You can try to add a click gesture to clampscrollable to focus the textview, but it is not going to behave consistently - e.g. you won’t be able to drag from there to select text

1 Like

Thanks for idea, I just want to move focus out from some browser navigation area by click on the content, but all the time clicking at the ‘empty’ ClampScrollable area instead of TextView.

Will try GestureClick so.

UPD. @alicem I can confirm, it’s really work!

// ..
// Init container widget
let clamp_scrollable = ClampScrollable::builder()
    .child(&gemini.text_view)
    .css_classes(["view"])
    .maximum_size(800)
    .build();

// Grab focus to the `TextView` on click empty `ClampScrollable` area
let controller = GestureClick::new();

controller.connect_released({
    let text_view = gemini.text_view.clone();
    move |_, _, _, _| {
        text_view.grab_focus();
    }
});

clamp_scrollable.add_controller(controller);
// ..