Skip to content

Commit

Permalink
cleaner aproach to button focusing
Browse files Browse the repository at this point in the history
  • Loading branch information
oetiker committed Oct 24, 2023
1 parent 8625d05 commit d89efbe
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
5 changes: 5 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
0.47.8 2023-10-24 11:23:11 +0200 Tobias Oetiker <tobi@oetiker.ch>

- force button to focus when it is touched ... this seems to
resolve the event order problem

0.47.7 2023-10-24 11:08:14 +0200 Tobias Oetiker <tobi@oetiker.ch>

- force button to focus when it is clicked
Expand Down
2 changes: 1 addition & 1 deletion lib/CallBackery.pm
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ use CallBackery::Plugin::Doc;
use CallBackery::Database;
use CallBackery::User;

our $VERSION = '0.47.7';
our $VERSION = '0.47.8';


=head2 config
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -468,16 +468,21 @@ qx.Class.define("callbackery.ui.plugin.Action", {
if (button) {
// in ios/android buttons do not necessarily get focus when clicked
// so we need to do it manually
let os = qx.core.Environment.get('os.name');
if (os == 'android' || os == 'ios'){
let orig_action = action;
action = () => {
//let os = qx.core.Environment.get('os.name');
//if (os == 'android' || os == 'ios'){
// let orig_action = action;
// action = () => {
// if (button.isFocusable()) {
// button.focus();
// }
// setTimeout(orig_action.bind(this),1);
// }
button.addListener('touchstart', () => {
if (button.isFocusable()) {
button.focus();
button.focus();
}
setTimeout(orig_action.bind(this),1);
}
}
}, this );
//}
button.addListener('execute', action, this);
if (btCfg.addToMenu) {
menues[btCfg.addToMenu].add(button);
Expand Down

0 comments on commit d89efbe

Please sign in to comment.