calendar: Grab key focus when user changes day
When the user changes the active day by mouse click or keyboard focus plus key press on a day in the grid, always move the keyboard focus to the newly activated day. This basically restores functionality that was introduced in commit31478e9fb4
but got lost again in the re-factoring in commitcc4659f5c6
. https://bugzilla.gnome.org/show_bug.cgi?id=725606
This commit is contained in:
parent
6441ae77d9
commit
257e1f3096
@ -403,6 +403,8 @@ const Calendar = new Lang.Class({
|
|||||||
// Start off with the current date
|
// Start off with the current date
|
||||||
this._selectedDate = new Date();
|
this._selectedDate = new Date();
|
||||||
|
|
||||||
|
this._shouldDateGrabFocus = false;
|
||||||
|
|
||||||
this.actor = new St.Table({ homogeneous: false,
|
this.actor = new St.Table({ homogeneous: false,
|
||||||
style_class: 'calendar',
|
style_class: 'calendar',
|
||||||
reactive: true });
|
reactive: true });
|
||||||
@ -608,7 +610,9 @@ const Calendar = new Lang.Class({
|
|||||||
|
|
||||||
button._date = new Date(iter);
|
button._date = new Date(iter);
|
||||||
button.connect('clicked', Lang.bind(this, function() {
|
button.connect('clicked', Lang.bind(this, function() {
|
||||||
|
this._shouldDateGrabFocus = true;
|
||||||
this.setDate(button._date);
|
this.setDate(button._date);
|
||||||
|
this._shouldDateGrabFocus = false;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
let hasEvents = this._eventSource.hasEvents(iter);
|
let hasEvents = this._eventSource.hasEvents(iter);
|
||||||
@ -674,8 +678,11 @@ const Calendar = new Lang.Class({
|
|||||||
this._rebuildCalendar();
|
this._rebuildCalendar();
|
||||||
|
|
||||||
this._buttons.forEach(Lang.bind(this, function(button) {
|
this._buttons.forEach(Lang.bind(this, function(button) {
|
||||||
if (_sameDay(button._date, this._selectedDate))
|
if (_sameDay(button._date, this._selectedDate)) {
|
||||||
button.add_style_pseudo_class('active');
|
button.add_style_pseudo_class('active');
|
||||||
|
if (this._shouldDateGrabFocus)
|
||||||
|
button.grab_key_focus();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
button.remove_style_pseudo_class('active');
|
button.remove_style_pseudo_class('active');
|
||||||
}));
|
}));
|
||||||
|
Loading…
Reference in New Issue
Block a user