Selection troubles with Gtk.Box

Запись экрана от 2024-12-21 11-21-34

In this GIF you can see that when navigation using keyboard, it’s selecting box before and button next. How to force it to select the button not box.
This object, as the others, is placed in Gtk.FlowBox

using Gtk 4.0;
using Adw 1;

template $SongCard: Box {
  orientation: vertical;
  halign: center;
  valign: start;

  styles [
    "card"
  ]

  Adw.Clamp {
    maximum-size: 160;
    unit: px;

    Overlay {
      [overlay]
      Revealer buttons_revealer {
        transition-type: slide_down;
        valign: start;
        halign: center;
        transition-duration: 100;

        Box {
          orientation: horizontal;
          margin-top: 8;
          spacing: 6;

          Button play_button {
            icon-name: "play-button-symbolic";
            tooltip-text: _("Sync");

            styles [
              "circular",
              "suggested-action"
            ]
          }

          Button metadata_editor_button {
            icon-name: "edit-metadata-symbolic";
            tooltip-text: _("Edit song metadata");

            styles [
              "circular",
              "osd"
            ]
          }
        }
      }

      Button cover_button {
        name: "cover_button";
        overflow: hidden;

        accessibility {
          labelled-by: title_label;
        }

        Box {
          orientation: vertical;

          Image cover {
            name: "cover";
            width-request: 160;
            height-request: 160;
            hexpand: true;
            vexpand: true;
            overflow: hidden;
            icon-name: "note-placeholder";
            pixel-size: 160;
            
            styles ["rounded"]
          }

          Label title_label {
            label: _("Title");
            ellipsize: end;
            hexpand: true;
            halign: start;
            margin-top: 4;
            margin-start: 8;
            margin-end: 8;
            use-markup: false;

            styles [
              "heading"
            ]
          }

          Label artist_label {
            label: _("Artist");
            ellipsize: end;
            hexpand: true;
            halign: start;
            margin-bottom: 4;
            margin-start: 8;
            margin-end: 8;
            use-markup: false;
          }
        }

        styles [
          "card"
        ]
      }
    }
  }
}

Try setting “focusable” property to false

Even with focusable set to False, it acts the same

It happens because this card is in Gtk.FlowBox, and this weird selection behavior is happening because of Gtk.FlowBoxChild is selecting first and SongCard then

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.