Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 290234

Summary: [Theming] Make focus appearance themeable
Product: [RT] RAP Reporter: Ralf Sternberg <rsternberg>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: tbuschto
Version: 1.3   
Target Milestone: 1.3 M3   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on:    
Bug Blocks: 239793    
Attachments:
Description Flags
Hides focus-frame by default
none
Custom frame for buttons
none
Custom Frame 2
none
Themeable Focus Indicator
none
Themeable Focus Indicator v2
none
Themeable Focus Indicator v3 none

Description Ralf Sternberg CLA 2009-09-23 06:17:13 EDT
By default, browsers draw a dotted rectangle around the focused element. This dotted rectangle should be themeable.

There is a CSS property "outline" to draw such a frame, but this property is not supported in IE.
IE provides an attribut "hideFocus" instead, that can be used to prevent drawing the focus frame.
Comment 1 Tim Buschtoens CLA 2009-09-30 06:42:23 EDT
Created attachment 148406 [details]
Hides focus-frame by default

This patch demonstrates how to disable the default focus-frame for all widgets. This works by manipulating the hideFocus-property in Widget.js, but the property can still be re-enabled by the appearance. 

Another possibility would by to set the property from outside the widget. This would not have to change Widget.js, however the property can then not be re-enabled by the appearance, only by calling setHideFocus.
Comment 2 Tim Buschtoens CLA 2009-09-30 06:51:05 EDT
A general solution for this could be as follows:
- The browser-native focus-frame is disabled for all Widgets. (See patch above)
- A singleton-widget is implemented, which (like the tooltip) floates above all other widgets and can display a themeable frame.
- This widget is notified from a central point when the focus changes.
- It checks the focused widget for a function, e.g. "getFocusFrameBounds" 
- If the function exists, it will be called, otherwise the frame-widget will be hidden.
- The function shall return either valid coordinates which will be used to position the frame-widget. Ot it does not return valid values (e.g. -1,-1), then the frame-widget will also be hidden.
Comment 3 Tim Buschtoens CLA 2009-10-06 09:16:00 EDT
Created attachment 148880 [details]
Custom frame for buttons

- Buttons have custom focus-frame
- All other widgets have no focus-frame
- Needs to rebuild qx.js
- Includes a test
- Frame is not (yet) themeable
- Focusing widgets that are not yet created will have no effect
- Unlike the previous implementation (and SWT/winxp), there is no difference in the visualization of the focus depending on the method used to focus (keyboard or mouse).
Comment 4 Tim Buschtoens CLA 2009-10-06 09:53:29 EDT
Created attachment 148882 [details]
Custom Frame 2

Some optimizations for rounded corners. See previous patch for notes.
Comment 5 Tim Buschtoens CLA 2009-10-27 08:06:12 EDT
Created attachment 150614 [details]
Themeable Focus Indicator

This patch contains several changes:

- The default focus-frame is disabled by default. qx.js must be rebuild for this.

- A themeable (border, background-color, layout) FocusIndicator is introduced.
- Currently only used for Button.
- Other than the old focus-frame, this indicator is displayed everytime a widget is focused, not only when using tab.
- Opacity and rounded borders are not yet supported.

- Tests are included.
- Some changes have also been made to TestRunner.js that are helpfull finding dom-level (like the focus-frame) problems, but are not needed for the tests to succeed.
- RAPThemeSupport is updated.

- Since the there is no more focus-frame for Slider and Scale, the "focused" state is introduced in CSS to enable some sort of focus-visualization. It is not used by default.
Comment 6 Tim Buschtoens CLA 2009-10-28 08:08:15 EDT
Created attachment 150716 [details]
Themeable Focus Indicator v2

Some refactoring based on RĂ¼digers specifications. All notes still valid.
Comment 7 Tim Buschtoens CLA 2009-10-28 08:19:05 EDT
Created attachment 150717 [details]
Themeable Focus Indicator v3

(Commited old version.)
Comment 8 RĂ¼diger Herrmann CLA 2009-10-28 09:52:02 EDT
Applied patch to CVS HEAD