Skip to content

Ensure a server is always selected when list gains focus - #3872

Merged
dingodoppelt merged 1 commit into
jamulussoftware:mainfrom
softins:connectdlg-fix-kbd-nav-one-server
Aug 9, 2026
Merged

Ensure a server is always selected when list gains focus#3872
dingodoppelt merged 1 commit into
jamulussoftware:mainfrom
softins:connectdlg-fix-kbd-nav-one-server

Conversation

@softins

@softins softins commented Aug 8, 2026

Copy link
Copy Markdown
Member

Short description of changes

This fixes keyboard navigation when the list only contains one server. When the server list gains focus,
if there was a saved server from previously being in focus, that saved server is restored. In this PR,
if there was no saved server, the first item in the list will be selected, so that keyboard navigation
will work properly.

No changelog entry needed, as this is just a bugfix for #3859

CHANGELOG: SKIP

Context: Fixes an issue?

Fixes #3871

Does this change need documentation? What needs to be documented and how?

No

Status of this Pull Request

Ready

What is missing until this pull request can be merged?

Nothing

Checklist

  • I've verified that this Pull Request follows the general code principles
  • I tested my code and it does what I want
  • My code follows the style guide
  • I waited some time after this Pull Request was opened and all GitHub checks completed without errors.
  • I've filled all the content above

This fixes keyboard navigation when the list only contains one server.
@softins softins added this to the Release 4.0.0 milestone Aug 8, 2026
@softins
softins requested review from dingodoppelt and pljones August 8, 2026 16:10
@softins softins self-assigned this Aug 8, 2026
@softins softins added bug Something isn't working backport_required A change to main that needs fix on an existing release. labels Aug 8, 2026
@softins softins added this to Tracking Aug 8, 2026
@github-project-automation github-project-automation Bot moved this to Triage in Tracking Aug 8, 2026
@dingodoppelt

Copy link
Copy Markdown
Member

Very nice, haven't come across that bug myself, yet, but the fix sounds very sensible.

@dingodoppelt dingodoppelt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just tested it and it works nicely :) Thank you!

@pljones pljones moved this from Triage to Waiting on Team in Tracking Aug 8, 2026
Comment thread src/connectdlg.cpp
}
else if ( lvwServers->topLevelItemCount() > 0 )
{
// no saved server: select first item in list for keyboard navigation

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this select the Directory by default? The default in Jamulus has been that hitting enter with nothing selected connects to the Directory.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Although, if the filter is in used, the Directory might not be visible -- still the default, even in that case, would have been for enter to join the Directory.)

@softins softins Aug 8, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is very old behaviour. If there is anything in the Server Address combo box, then Enter will connect to that server.

In order to test your assertion, I needed to clear my whole list of custom servers to make the combo box empty.

Having done that, I selected a directory (e.g. private.jamulus.io or one of my own), and without clicking on a server in the list I pressed Enter. To my surprise, it connected to the Any Genre 1 directory server! That was the case whichever directory I had selected. I think that is the behaviour you are remembering, and in fact I would argue that behaviour is now obsolete.

So I don't think there is much utility in making the directory the one that is selected, as it might be some way down the list, if its ping is a lot greater than some of its registered servers.

This PR is just to make keyboard navigation work consistently when tabbing into the server list, and the first item in the list is the natural one to start with if you are going to cursor down the list.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To my surprise, it connected to the Any Genre 1 directory server! That was the case whichever directory I had selected. I think that is the behaviour you are remembering, and in fact I would argue that behaviour is now obsolete.

That seems very weird. For any user not living near Frankfurt that server seems like a bad choice.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That behaviour dates from b63a625 in 2015, and has been functionally unchanged since.

In CClientDlg::OnConnectDlgAccepted():

jamulus/src/clientdlg.cpp

Lines 760 to 768 in a24e09c

// special case: if the address is empty, we substitute the default
// directory address so that a user who just pressed the connect
// button without selecting an item in the table or manually entered an
// address gets a successful connection
if ( strSelectedAddress.isEmpty() )
{
strSelectedAddress = DEFAULT_SERVER_ADDRESS;
strMixerBoardLabel = tr ( "%1 Directory" ).arg ( DirectoryTypeToString ( AT_DEFAULT ) );
}

I think it's time we didn't do that, but instead either ignored the Connect button if a server isn't selected, or displayed a message box. But that's for a separate PR.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh... I didn't realise it was still DEFAULT_SERVER_ADDRESS -- I thought when the custom Directories got added it got updated to the currently selected Directory, as a fallback in cases where nothing was selected.

Anyway, I agree, given the current version isn't adequate, anything is probably an improvement.

@dingodoppelt
dingodoppelt merged commit ea5db7e into jamulussoftware:main Aug 9, 2026
11 checks passed
@github-project-automation github-project-automation Bot moved this from Waiting on Team to Done in Tracking Aug 9, 2026
pljones pushed a commit that referenced this pull request Aug 9, 2026
This fixes keyboard navigation when the list only contains one server.
@pljones pljones modified the milestones: Release 4.0.0, Release 3.12.4 Aug 9, 2026
@pljones pljones removed the backport_required A change to main that needs fix on an existing release. label Aug 9, 2026
@softins
softins deleted the connectdlg-fix-kbd-nav-one-server branch August 9, 2026 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Edge case in #3859 with keyboard navigation

3 participants