jabref icon indicating copy to clipboard operation
jabref copied to clipboard

Create a function that brings the selected entry into view

Open ryan-carpenter opened this issue 3 months ago β€’ 24 comments

Several JabRef issues have pointed out that it isn't always clear which entry is selected or how to find it in the main table. The problem is that the selected entry can move out of view in the main table. This happens when the user scrolls away in the main table, changes data that affects how the entry is sorted in the table, adds a new entry, and for other reasons.

Why the entry moved and where it went is less of a concern if there is an easy way to bring the selected entry back into view.

Proposed solution

  • Create a function that brings the selected entry to the center of the entry table's visible rows.
  • Add the function to the View menu to make the function discoverable and available in the GUI.
  • Assign a default shortcut and show the function in Preferences > Keyboard shortcuts.

The function must work any time an entry is selected, even if the entry table does not have focus. This is because selecting the table to give it focus also changes which entry is selected, defeating the purpose of the proposed shortcut.

Additional context

ℹ️ The shortcut for 'Accept' has the effect of scrolling the selected entry into view. However, it does not work in all applicable situations. For example, when the editor is open and has focus, that shortcut doesn't work even though an entry is selected in the table.

Other issues about user disorientation in the entry table.

  • https://github.com/JabRef/jabref/issues/7450
  • https://github.com/JabRef/jabref/issues/8174
  • https://github.com/JabRef/jabref/issues/11673
  • https://github.com/JabRef/jabref/issues/12643
  • https://github.com/JabRef/jabref/issues/3436

Here are some examples from the "Accept" shortcut (Command-return on macOS, Control+Enter and Super+Enter on Windows and Linux, respectively).

Example 1 Image

Beel2018-amd is selected and already in view.

Example 2 Image

Beel2018-amd is selected, but not in view

Example 3 Image

Blouin-2017-uid is selected near the end of the table.

Result (Examples 1 & 2) Image

The "Accept" shortcut moves Beel-2018-amd to the top of the view.

Result (Example 3) Image

The "Accept" shortcut moves Blouin2017-uid up as far as possible in the view.

ryan-carpenter avatar Aug 24 '26 12:08 ryan-carpenter

This issue previously suggested adding documentation for an existing function. I corrected the title and description after finding that the existing function ("Accept") is already included in Preferences > Keyboard shortcuts.

ryan-carpenter avatar Aug 28 '26 14:08 ryan-carpenter

πŸ‘‹ Hey @sahariya-divyansh, looks like you’re eager to work on this issue β€” great! πŸŽ‰ It also looks like you don't know how to assign issues to yourself. Please read our CONTRIBUTING.md to find out how. It will also guide you in other aspects of contributing to JabRef.

jabref-machine avatar Aug 31 '26 03:08 jabref-machine

/assign-me

sahariya-divyansh avatar Aug 31 '26 03:08 sahariya-divyansh

πŸ‘‹ Hey @sahariya-divyansh, thank you for your interest in this issue! πŸŽ‰

We're excited to have you on board. Start by exploring our Contributing guidelines, and set up your local development workspace by following the steps in our workspace setup guidelines to get started smoothly.

For questions on JabRef functionality, you can consult the JabRef Guru. For questions related to the codebase, please start using DeepWiki.

In case you encounter failing tests during development, please check our developer FAQs!

Still facing issues or having more questions? Feel free to ask here on GitHub or on JabRef's Gitter chat. Please don't hesitate to open a (draft) pull request early on to show the direction you are heading towards if unsure.

Happy coding! πŸš€

jabref-machine avatar Aug 31 '26 03:08 jabref-machine

@sahariya-divyansh, there are two things that inspired my suggestion to add this feature.

First, it's a workaround for the various situations where JabRef has determine the "right" scroll-position of the main table. It's tricky to anticipate all the situations and always match user expectations in every one. If the selected entry is not in view and I don't know whether it moved up or down, the re-centering function solves the problem immediately. Even if I know where the entry has gone, I still want to bring it back into view immediately and not have to scroll to it every time something changes.

The main idea for the suggestion comes from the default keybindings in macOS and Emacs, where Control + L centers the current line vertically in an editor. This is why I suggested centering the selected entry rather than moving it to the top or bottom of the visible part of the entry table.

For reference: In macOS language "Control-L" means "Center the cursor or selection in the visible area". Emacs is the same, except that the function cycles though center-->top-->bottom-->center and so on. In Emacs terminology, "C-l" invokes the recenter-top-bottom function which means "Scroll the window so that current line is in the middle of the window." Invoking the function a second time means "put the current line at the top-most window line, [and] the third invocation puts it on the bottom-most window line".

I have also suggested adding this shortcut to the entry editor (https://github.com/JabRef/jabref/issues/16529). However, there is already a default keybinding for Control + L (push to external editor). I would consider that only nice to have, whereas scrolling instantly to the current entry, especially when the user feels "lost", is far more important.

ryan-carpenter avatar Aug 31 '26 10:08 ryan-carpenter

I think, it also closes https://github.com/JabRef/jabref/issues/16035?

idea 1 & 3 can be both implemented imo:

idea 1: select and focus newly added entry etc. idea 3: when user scrolls away in the main table and does not select another entry, use shortcut to scoll back

pluto-han avatar Sep 03 '26 07:09 pluto-han

/assign-me

T1ANC0 avatar Sep 07 '26 16:09 T1ANC0

πŸ‘‹ Hey @T1ANC0, thank you for your interest in this issue! πŸŽ‰

We're excited to have you on board. Start by exploring our Contributing guidelines, and set up your local development workspace by following the steps in our workspace setup guidelines to get started smoothly. When using AI tools, please use them as an assistant rather than simply copying their output. See Don't paste the AI, please.. For questions on JabRef functionality, you can consult the JabRef Guru. For questions related to the codebase, please start using DeepWiki.

In case you encounter failing tests during development, please check our developer FAQs!

Still facing issues or having more questions? Feel free to ask here on GitHub or on JabRef's Gitter chat. Please don't hesitate to open a (draft) pull request early on to show the direction you are heading towards if unsure.

Happy coding! πŸš€

jabref-machine avatar Sep 07 '26 16:09 jabref-machine

⏰ Assignment Reminder

Hi @T1ANC0, this is a friendly reminder about your assignment to this issue.

[!WARNING] This issue will be automatically unassigned in 4 days if there's no activity.

Remember that you can ask the JabRef Guru or DeepWiki about anything regarding JabRef. Additionally, our contributing guide has hints on creating a pull request and a link to our Gitter chat.

How to keep your assignment


If you are working on it, you can prevent automatic unassignment by:

  • Submitting a draft pull request with your progress within 4 days
  • Asking for the πŸ“Œ Pinned label if you need more time

We appreciate your contribution and are here to help if needed!

github-actions[bot] avatar Sep 11 '26 12:09 github-actions[bot]

The issue description previously stated that the existing "Accept" function might be an acceptable solution. I've updated the description after confirming that this will not work.

ryan-carpenter avatar Sep 14 '26 11:09 ryan-carpenter

Create a function that brings the selected entry to the center of the entry table's visible rows.

This is implemented in https://github.com/JabRef/jabref/pull/16845

What's left is to design a shortcut that scrolls selected entry back to view. Please correct me if I am wrong @ryan-carpenter

pluto-han avatar Sep 14 '26 12:09 pluto-han

Hi! I'd like to contribute to this issue. I saw that the centering functionality has been implemented in a related pull request. Could you clarify whether the remaining work is keyboard shortcut integration, handling focus in the entry editor, or something else? I'd be happy to work on the remaining part.

Nrj27 avatar Oct 17 '26 14:10 Nrj27

Hi! I'd like to contribute to issue #16658. I saw the related PR #17168 and would like to help with any remaining work. Could you confirm whether keyboard shortcut handling, editor focus behavior, and the related tests are fully covered, or whether there is still a specific task to work on?

Nrj27 avatar Oct 17 '26 14:10 Nrj27

/assign-me

Linuger avatar Nov 19 '26 12:11 Linuger

Thank you for your continued work in JabRef. At this point, you probably already know the basics and the important links. If not, our contributing guidelines is the place you should go to.

At this point in time, you raised 2 pull request(s) of which 50% (1/2) have been merged.

jabref-machine avatar Nov 19 '26 12:11 jabref-machine

⏰ Assignment Reminder

Hi @Linuger, this is a friendly reminder about your assignment to this issue.

[!WARNING] This issue will be automatically unassigned in 4 days if there's no activity.

Remember that you can ask the JabRef Guru or DeepWiki about anything regarding JabRef. Additionally, our contributing guide has hints on creating a pull request and a link to our Gitter chat.

How to keep your assignment


If you are working on it, you can prevent automatic unassignment by:

  • Submitting a draft pull request with your progress within 4 days
  • Asking for the πŸ“Œ Pinned label if you need more time

We appreciate your contribution and are here to help if needed!

github-actions[bot] avatar Nov 22 '26 12:11 github-actions[bot]

πŸ“‹ Assignment Update

Hi @Linuger, due to inactivity, you have been unassigned from this issue.

Next steps


If you still want to work on this:

  • Submit a pull request showing your current state. You will be automatically assigned again.
  • Ask a maintainer to assign you again.

github-actions[bot] avatar Nov 29 '26 12:11 github-actions[bot]

/assign-me

Nrj27 avatar Nov 29 '26 14:11 Nrj27

πŸ‘‹ Hey @Nrj27, thank you for your interest in this issue! πŸŽ‰

We're excited to have you on board. Start by exploring our Contributing guidelines, and set up your local development workspace by following the steps in our workspace setup guidelines to get started smoothly. When using AI tools, please use them as an assistant rather than simply copying their output. See Don't paste the AI, please.. For questions on JabRef functionality, you can consult the JabRef Guru. For questions related to the codebase, please start using DeepWiki.

In case you encounter failing tests during development, please check our developer FAQs!

Still facing issues or having more questions? Feel free to ask here on GitHub or on JabRef's Gitter chat. Please don't hesitate to open a (draft) pull request early on to show the direction you are heading towards if unsure.

Happy coding! πŸš€

jabref-machine avatar Nov 29 '26 14:11 jabref-machine

Hi, I opened a pull request for this issue: #17974

It adds "Center selected entry" to the View menu with the default shortcut Ctrl+Alt+L. It scrolls the selected entry to the middle of the main table and also works when the entry editor has focus.

Ctrl+L and Ctrl+Shift+L are already used, so I chose Ctrl+Alt+L. Please tell me if you would like a different shortcut.

Nrj27 avatar Nov 29 '26 16:11 Nrj27