Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Left and right keys do not work in the search bar #3081

Closed
iTao8 opened this issue Aug 7, 2017 · 7 comments
Closed

Left and right keys do not work in the search bar #3081

iTao8 opened this issue Aug 7, 2017 · 7 comments
Assignees
Labels
component: search component: ui [outdated] type: bug Confirmed bugs or reports that are very likely to be bugs
Milestone

Comments

@iTao8
Copy link

iTao8 commented Aug 7, 2017

JabRef 4.0-dev--snapshot--2017-08-06--master--b7743c4d7
Mac OS X 10.11.6 x86_64
Java 1.8.0_144

Steps to reproduce:

  1. input "LeftRight" in the search bar
  2. try to use left and right keys so that we can move the cursor and insert a space between "t" and "R"
  3. the left and right keys do not move the cursor
@Siedlerchr
Copy link
Member

Also confirmed under Windows. The left/right keys move the focus away from the field.
I think this is not really related to the keybindings, but more a focus problem.
@tobiasdiez You looked into that focus problem, any idea why the focus does not stay in the field?`

@tobiasdiez tobiasdiez added the [outdated] type: bug Confirmed bugs or reports that are very likely to be bugs label Aug 8, 2017
@lenhard
Copy link
Member

lenhard commented Aug 10, 2017

I'll be so brave and add this to the 4.0 milestone as one of the things we can fix before the final release.

@lenhard lenhard added this to the v4.0 milestone Aug 10, 2017
@tobiasdiez
Copy link
Member

Even the "Mouse down" event focuses the next button. This actually renders the autocompletion useless since one cannot select the next item.

@Siedlerchr Siedlerchr self-assigned this Aug 25, 2017
@snisnisniksonah
Copy link
Contributor

Could adding an else { e.consume(); } here fix this?

public void keyPressed(java.awt.event.KeyEvent e) {
//We need to consume this event here to prevent the propgation of keybinding events back to the JFrame
Optional<KeyBinding> keyBinding = Globals.getKeyPrefs().mapToKeyBinding(e);
if (keyBinding.isPresent()) {
switch (keyBinding.get()) {
case CUT:
case COPY:
case PASTE:
case DELETE_ENTRY:
case SELECT_ALL:
e.consume();
break;
default:
//do nothing
}
}

Since i'm not a 100% certain how the searchbar should behave i don't know what to look for when testing, but i didn't see anything out of the ordinary in a quick GUI test.

@koppor
Copy link
Member

koppor commented Sep 3, 2017

Tested it. Works. Have a slight other issue (see JabRef#252), but not a blocker.

@koppor
Copy link
Member

koppor commented Sep 3, 2017

And another one, which is not directly related to this PR: JabRef#253

@Siedlerchr
Copy link
Member

I did some research onto this specific issue and it seems like the problem is here the JToolBar which has an implicit KeyListener registered for the arrow keys.
So I guess when we rework the toolbar the workaround should be no longer necessary
https://stackoverflow.com/a/17049479/3450689

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: search component: ui [outdated] type: bug Confirmed bugs or reports that are very likely to be bugs
Projects
None yet
Development

No branches or pull requests

6 participants