Problem with FormText and focus [message #328827] |
Wed, 04 June 2008 11:33  |
Eclipse User |
|
|
|
Originally posted by: higginmi.xxxx.xxx
This is a multi-part message in MIME format.
--------------050500080608060300060006
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
In order to get screen readers to read widgets, the widget must accept
focus. In Eclipse 3.3 and earlier, FormText widgets could accept focus
but would not display a caret. This worked fine for screen readers but
was a little disconcerting to sighted users since there was no
indication of what had focus. For our application, we added a caret to
all our FormText instances. This worked fine. Screen readers were happy.
Sighted users were happy. Management was happy :-).
Unfortunately, things have changed in Eclipse 3.4. We first noticed this
because our FormText instances no longer received focus but a caret
would be displayed in the FormText field. Focus is on the first
focusable field after the FormText but the caret is displayed in the
FormText and not the focusable field. The horizontal position of the
caret matches the horizontal position it would be in if inside the
focusable field. I have attached a snippet demonstrating this. Run it
and you will see the caret start off in the FormText field. If you type
something you will notice the characters show up in the "Label 1" input
field and the caret moves in the FormText field. Press Tab and the focus
and caret moves to the "Label 2" input field. Press Tab again and focus
moves to the "Label 1" input field but the caret is displayed in the
FormText field - again horizontally matching where it would be in the
"Label 1" input field. If you use Shift+Tab to tab backwards, the focus
and caret match up fine.
Looking at the differences in the FormText code, it appears a conscious
decision was made to remove the ability to focus on FormText fields
unless they contain links. The handleFocusChange method will move focus
to the next field if no selectable objects are in the FormText.
I have several questions and concerns:
1) Why was this decision made?
2) How do I get screen readers, e.g., JAWS, to read FormText fields in
Eclipse 3.4 as the user tabs from field to field on the screen?
3) Although the example does not show it, we mainly use FormText fields
when we need the simple tag-based formatting (e.g., bolding, lists) the
class supports. Is there another widget that would be better (and just
as easy) to use and is accessible to screen readers?
Thanks,
Mike Higginbotham
--------------050500080608060300060006
Content-Type: text/java;
name="FormTextFocusTest.java"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="FormTextFocusTest.java"
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.FontMetrics;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Caret;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.forms.widgets.FormText;
public class FormTextFocusTest {
protected Shell shell;
/**
* Launch the application
*
* @param args
*/
public static void main(String[] args) {
try {
FormTextFocusTest window = new FormTextFocusTest();
window.open();
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* Open the window
*/
public void open() {
final Display display = Display.getDefault();
createContents();
shell.open();
shell.layout();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
}
/**
* Create contents of the window
*/
protected void createContents() {
shell = new Shell();
shell.setLayout(new FillLayout());
shell.setSize(500, 375);
shell.setText("FormText Focus Test");
Composite content = new Composite(shell, SWT.NONE);
GridLayout layout = new GridLayout();
layout.numColumns = 1;
content.setLayout(layout);
FormText ft1 = new FormText(content, SWT.NONE);
ft1.setText("This is a FormText field with a Caret.", false, false);
Caret caret1 = createCaret(ft1);
ft1.setCaret(caret1);
Label label1 = new Label(content, SWT.NONE);
label1.setText("Label 1:");
new Text(content, SWT.BORDER | SWT.SINGLE);
FormText ft2 = new FormText(content, SWT.NONE);
ft2.setText("This is a FormText field without a Caret.", false, false);
Label label2 = new Label(content, SWT.NONE);
label2.setText("Label 2:");
new Text(content, SWT.BORDER | SWT.SINGLE);
}
private Caret createCaret(Canvas c) {
Caret caret = new Caret(c, SWT.NONE);
int fontHeight;
GC gc = new GC(c.getDisplay());
FontMetrics fm = gc.getFontMetrics();
fontHeight = fm.getHeight();
gc.dispose();
caret.setSize(1, fontHeight);
return caret;
}
}
--------------050500080608060300060006--
|
|
|
Re: Problem with FormText and focus [message #328829 is a reply to message #328827] |
Wed, 04 June 2008 11:45  |
Eclipse User |
|
|
|
Originally posted by: higginmi.xxxx.xxx
I found the bug that "fixed" this -
https://bugs.eclipse.org/bugs/show_bug.cgi?id=178557. That at least
explains why but I am not sure it was the correct fix.
-- Mike
Mike Higginbotham wrote:
> In order to get screen readers to read widgets, the widget must accept
> focus. In Eclipse 3.3 and earlier, FormText widgets could accept focus
> but would not display a caret. This worked fine for screen readers but
> was a little disconcerting to sighted users since there was no
> indication of what had focus. For our application, we added a caret to
> all our FormText instances. This worked fine. Screen readers were happy.
> Sighted users were happy. Management was happy :-).
>
> Unfortunately, things have changed in Eclipse 3.4. We first noticed this
> because our FormText instances no longer received focus but a caret
> would be displayed in the FormText field. Focus is on the first
> focusable field after the FormText but the caret is displayed in the
> FormText and not the focusable field. The horizontal position of the
> caret matches the horizontal position it would be in if inside the
> focusable field. I have attached a snippet demonstrating this. Run it
> and you will see the caret start off in the FormText field. If you type
> something you will notice the characters show up in the "Label 1" input
> field and the caret moves in the FormText field. Press Tab and the focus
> and caret moves to the "Label 2" input field. Press Tab again and focus
> moves to the "Label 1" input field but the caret is displayed in the
> FormText field - again horizontally matching where it would be in the
> "Label 1" input field. If you use Shift+Tab to tab backwards, the focus
> and caret match up fine.
>
> Looking at the differences in the FormText code, it appears a conscious
> decision was made to remove the ability to focus on FormText fields
> unless they contain links. The handleFocusChange method will move focus
> to the next field if no selectable objects are in the FormText.
>
> I have several questions and concerns:
>
> 1) Why was this decision made?
> 2) How do I get screen readers, e.g., JAWS, to read FormText fields in
> Eclipse 3.4 as the user tabs from field to field on the screen?
> 3) Although the example does not show it, we mainly use FormText fields
> when we need the simple tag-based formatting (e.g., bolding, lists) the
> class supports. Is there another widget that would be better (and just
> as easy) to use and is accessible to screen readers?
>
> Thanks,
> Mike Higginbotham
>
|
|
|
Powered by
FUDForum. Page generated in 0.02635 seconds