Skip to content

Commit

Permalink
Create a dummy button in the sidebar.
Browse files Browse the repository at this point in the history
An invisible button catches the focus instead of the
"All Tasks" row. Thanks to this button, unintended view
resets can be avoided when a focused widget is removed.

This fixes GitHub issue #1017
  • Loading branch information
gycsaba96 authored and diegogangl committed May 1, 2024
1 parent cf9dc27 commit dc0eb1a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
6 changes: 6 additions & 0 deletions GTG/gtk/browser/sidebar.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@ def __init__(self, app, ds: Datastore, browser):
wrap_box.set_vexpand(True)
wrap_box.set_hexpand(True)

# Create an invisible dummy button to catch focus in some edge cases
self.dummy = Gtk.Button()
self.dummy.set_size_request(0, 0)
self.dummy.add_css_class('dummy')
wrap_box.append(self.dummy)

# -------------------------------------------------------------------------------
# General Filters
# -------------------------------------------------------------------------------
Expand Down
10 changes: 10 additions & 0 deletions GTG/gtk/data/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@
border-top: 1px solid rgb(213, 208, 204);
}

.dummy {
background: transparent;
border: none;
color: transparent;
font-size: 0.001px;
margin: -100px;
opacity: 0;
padding: 0;
}

/*
We have to get move the padding into the boxes
so the background color of the rows reaches all
Expand Down

0 comments on commit dc0eb1a

Please sign in to comment.