After opening and switching to a new tab, always focus the view
ClosedPublic

Authored by ngraham on Dec 16 2018, 10:53 PM.

Details

Summary

When Dolphin opens a new tab and immediately switches to it, the URL navigator gets focus if it's editable. If it's not, the breadcrumbs bar gets keyboard focus, which is not very useful since it's not really intended for keyboard navigation.

This patch changes that behavior so that the view always gets focus, which seems more useful and more consistent.

BUG: 401899
FIXED-IN: 19.04.0

Test Plan
  1. Put the URL navigator into breadcrumbs mode
  2. Open a new tab
  3. Observe that the view gets keyboard focus
  4. Put the URL navigator into editable mode
  5. Open a new tab
  6. Observe that the view still gets keyboard focus

Diff Detail

Repository
R318 Dolphin
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
ngraham created this revision.Dec 16 2018, 10:53 PM
Restricted Application added a project: Dolphin. · View Herald TranscriptDec 16 2018, 10:53 PM
Restricted Application added a subscriber: kfm-devel. · View Herald Transcript
ngraham requested review of this revision.Dec 16 2018, 10:53 PM
ngraham updated this revision to Diff 47702.Dec 16 2018, 10:55 PM

Add comment

This feels like a workaround. Why does the url navigator get focus in the first place? We should try to understand where this is happening and fix it there.

ngraham updated this revision to Diff 47985.Dec 22 2018, 5:32 AM

Current code actually does nothing; change to a useful behavior

Investigated a bit. The focus seems to be automatically placed on the URL navigator, so the existing code actually does nothing. I've adjusted the patch to make it select all if the URL navigator is editable, since that facilitates rapid replacement of the existing text with a new path.

Friendly ping.

src/dolphintabwidget.cpp
139–141

I'd be ok with this, but it seems unrelated. Please either update the commit message or move this change to another commit.

ngraham retitled this revision from After opening a new tab, focus the view if the URL navigator is in breadcrumbs mode to Refine focus behavior after opening a new tab.Jan 19 2019, 3:57 PM
ngraham edited the summary of this revision. (Show Details)
ngraham edited the test plan for this revision. (Show Details)

Chiming in here as the author of the bug report mentioned in this patch.

The focus should always go to the view, as it allows the user to interact with the newly opened tab and navigating from there without needing mouse input as all other elements are accessible from keyboard. The proposal of focusing the location bar or something else depending on the location bar being editable or not, is very arbitrary. The location bar can also be focused via F6 and Ctrl+L.

@elvisangelaccio would you be okay with changing the behavior to always focus the view upon opening a new tab as @emateli requests? I'm pretty much fine with anything, but I'd rather we decide on something so this poor patch can come to the end of its end its identity crisis. :-)

@elvisangelaccio would you be okay with changing the behavior to always focus the view upon opening a new tab as @emateli requests? I'm pretty much fine with anything, but I'd rather we decide on something so this poor patch can come to the end of its end its identity crisis. :-)

Yes, his point makes sense to me. Please update the commit message as well.

ngraham updated this revision to Diff 50458.Jan 28 2019, 10:42 PM
ngraham retitled this revision from Refine focus behavior after opening a new tab to After opening and switching to a new tab, always focus view.
ngraham edited the summary of this revision. (Show Details)
ngraham edited the test plan for this revision. (Show Details)

Always focus the new tab's view

ngraham retitled this revision from After opening and switching to a new tab, always focus view to After opening and switching to a new tab, always focus the view.Jan 28 2019, 10:45 PM
ngraham updated this revision to Diff 50459.Jan 28 2019, 10:48 PM

Use a more consistent coding style and remove a now-unnecessary variable

elvisangelaccio accepted this revision.Jan 29 2019, 10:32 AM
This revision is now accepted and ready to land.Jan 29 2019, 10:32 AM
This revision was automatically updated to reflect the committed changes.