Bug 55816 - [ViewMgmt] Focus lost when showing view
Summary: [ViewMgmt] Focus lost when showing view
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows 2000
: P2 major (vote)
Target Milestone: 3.0 M9   Edit
Assignee: Nick Edgar CLA
QA Contact:
URL:
Whiteboard:
Keywords: accessibility
Depends on: 56169
Blocks: 54296
  Show dependency tree
 
Reported: 2004-03-23 21:37 EST by Nick Edgar CLA
Modified: 2004-05-13 15:06 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Edgar CLA 2004-03-23 21:37:42 EST
build I20040323-0800

- new window in Java perspective
- Window > Show View > Other > Team > Synchronize
- no controls have focus

Focus should be given to the view.
Comment 1 Nick Edgar CLA 2004-03-23 21:38:28 EST
Must fix for M8.
Comment 2 Nick Edgar CLA 2004-03-25 09:40:01 EST
This is fundamental to the workbench, and is important for accessibility.
Comment 3 Douglas Pollock CLA 2004-03-25 11:12:28 EST
This blocks Bug 54926. 
Comment 4 Michael Van Meekeren CLA 2004-03-25 12:09:30 EST
this is only a problem on views that do not have any contents.  I.e. 
Outline/syncrhonize
Comment 5 Tod Creasey CLA 2004-03-25 13:06:42 EST
The problem is that ViewPane is hard coding the tab list to not include the 
title bar. This code should just be deleted.

ViewPane

/**
	 * 
	 */
	private void setTabList() {
		// Only include the ISV toolbar and the content in the tab 
list.
		// All actions on the System toolbar should be accessible on 
the pane menu.
		if (control.getContent() == null) {
		} else {
//			control.setTabList(new Control[] {control.getContent
()});
		}
	}
Comment 6 Michael Van Meekeren CLA 2004-03-25 17:28:28 EST
There seems to be two problems here:
1. The view does not take focus initially.  The view's setFocus() should be 
getting called, and the view should set focus to the appropriate control, even 
if the control does not show focus (e.g. a Label).

2. When a view does take focus, you can't tab out of it.  This is the tabList 
regression.

I have a fix for 2 I'm about to release to head.  We should retest 1 with the 
fix and see if it has any impact.
Comment 7 Nick Edgar CLA 2004-03-25 17:45:08 EST
Note: the previous comment was from me.
Comment 8 Nick Edgar CLA 2004-03-25 17:48:06 EST
Fix released for part 2.  Reassigning to Tod for part 1.
Comment 9 Tod Creasey CLA 2004-03-25 17:48:32 EST
1) is being caused in this case by use saying page.getControl().setFocus() 
instead of page.getFocus(). I will be adding this too.

Marking as fixed as the focus problem reported in this PR is fixed by my 
addition.

Nick we did not pursue a more robust solution to the focus issue due to its 
complexity.
Comment 10 Tod Creasey CLA 2004-03-25 21:43:11 EST
Does not appear to be fixed after all.
Comment 11 Tod Creasey CLA 2004-03-25 21:53:39 EST
The general case is now fixed but there are some hard to replicate cases where 
this is still a problem. 

Marking post M8 as the main case is fixed.
Comment 12 Nick Edgar CLA 2004-03-26 11:51:56 EST
Still a problem for the Console and Outline views.  The fix above may have made
this worse in the case where the PageBookView doesn't have a page yet.

Before running any code,
- close all perspectives
- open resource perspective
- close outline view
- give focus to Navigator (with some content there)
- Window > Show View > Outline using keyboard
- Navigator still has focus
- Window > Show View > Console using keyboard
- Navigator still has focus
Comment 13 Nick Edgar CLA 2004-03-26 11:57:49 EST
Traced through it.  In the empty case, there is still a message page, whose
label is being told to setFocus().  But this is a no-op because the label has
SWT.NO_FOCUS style.

I'm left wondering how this ever worked before.  Steve, have their been any
changes to the semantics of setFocus() in 3.0, particulary for controls that
don't normally take focus?
Comment 14 Nick Edgar CLA 2004-03-26 12:01:06 EST
It's worse than that:

- with no editors open, package explorer and outline open
- give focus to package explorer
- click on outline view (either its tab or the label)
- focus is still in the package explorer
Comment 15 Nick Edgar CLA 2004-03-26 12:24:51 EST
Yesterday's fix did make the problem worse.  The PageBookView.setFocus did:
	activeRec.page.getControl().setFocus();
it was changed to
	activeRec.page.setFocus();

The difference is that the former sets focus on the page's composite, the latter
on the label.  Composites force focus on themselves if none of their children
take focus.

Comment 16 Steve Northover CLA 2004-03-26 12:39:00 EST
Yes, in 3.0, if you hook key events, you will get focus and participate in 
traversal.  The SWT.NO_FOCUS (badly named) stops focus on mouse click.  The 
2.x behavior was inconsistent across platforms and didn't allow you to 
implement a "tool bar-like" Custom Control that took part in traversal and had 
keys for accessibility but didn't take focus with the mouse.  Sorr\y..
Comment 17 Nick Edgar CLA 2004-03-26 13:20:47 EST
Thanks for clarifying.  The changes you describe are not the cause of the
problems above.
Comment 18 Tod Creasey CLA 2004-03-29 09:28:05 EST
Moving bacl to Nick
Comment 19 Nick Edgar CLA 2004-04-01 14:35:12 EST
Released a fix to PageBookView and MessagePage.
Comment 20 Nick Edgar CLA 2004-04-15 10:02:23 EDT
Still a problem with the sync view in I20040407.
Comment 21 Kim Horne CLA 2004-05-13 13:53:21 EDT
This appears to be fixed... care to verify Nick?
Comment 22 Nick Edgar CLA 2004-05-13 15:06:27 EDT
It does seem to be fixed now.