After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 611254 - object:text-changed events lack any_data
object:text-changed events lack any_data
Status: RESOLVED OBSOLETE
Product: java-atk-wrapper
Classification: Applications
Component: general
unspecified
Other opensolaris
: Normal normal
: ---
Assigned To: java-atk-wrapper maintainer(s)
java-atk-wrapper maintainer(s)
: 616886 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2010-02-27 02:34 UTC by Joanmarie Diggs (IRC: joanie)
Modified: 2021-05-17 15:39 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Joanmarie Diggs (IRC: joanie) 2010-02-27 02:34:40 UTC
The any_data field of object:text-changed:insert and object:text-changed:delete events is expected to contain the string inserted or deleted. This string seems to be missing for Java apps.

Impact:

* Orca cannot indicate to the user which character was just deleted.

* If character echo is enabled (NOT the same thing as key echo), Orca cannot indicate what character was just inserted via the keyboard.

* Orca cannot indicate what string was just pasted into a document.

Steps to reproduce:

1. Launch Accerciser and turn on event-monitoring for object:text-changed events for the selected application.

2. Launch Gedit, type 'abc' and then press Backspace 3 times to remove the characters that were just inserted.

3. Launch a Java app (e.g. Notepad.jar), type 'abc' and then press Backspace 3 times to remove the characters that were just inserted.

4. Compare the output:

Gedit

object:text-changed:insert(0, 1, a)
	source: [text | ]
	application: [application | gedit]
object:text-changed:insert(1, 1, b)
	source: [text | ]
	application: [application | gedit]
object:text-changed:insert(2, 1, c)
	source: [text | ]
	application: [application | gedit]
object:text-changed:delete(2, 1, c)
	source: [text | ]
	application: [application | gedit]
object:text-changed:delete(1, 1, b)
	source: [text | ]
	application: [application | gedit]
object:text-changed:delete(0, 1, a)
	source: [text | ]
	application: [application | gedit]

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Notepad.jar

object:text-changed:insert(0, 1, )
	source: [text | ]
	application: [application | Notepad]
object:text-changed:insert(1, 1, )
	source: [text | ]
	application: [application | Notepad]
object:text-changed:insert(2, 1, )
	source: [text | ]
	application: [application | Notepad]
object:text-changed:delete(2, 1, )
	source: [text | ]
	application: [application | Notepad]
object:text-changed:delete(1, 1, )
	source: [text | ]
	application: [application | Notepad]
object:text-changed:delete(0, 1, )
	source: [text | ]
	application: [application | Notepad]
Comment 1 Ke Wang 2010-05-11 08:31:01 UTC
*** Bug 616886 has been marked as a duplicate of this bug. ***
Comment 2 André Klapper 2012-02-26 10:41:25 UTC
[Resetting QA Contact to newly introduced "at-spi-maint@gnome.bugs". 
Reason: So far it was impossible to watch changes in at-spi bug reports without following all the specific persons (Li Yuan, Bill Haneman, Jeff Wai, ...) and also their activity outside of at-spi reports.

IMPORTANT: Anyone interested in following all bug activity (including all maintainers) must watch the "at-spi-maint@gnome.bugs" dummy user by adding it to the 'Users to watch' list under Preferences->Email preferences. This is also the default procedure nowadays in GNOME when setting up new products.]
Comment 3 André Klapper 2013-08-14 10:04:14 UTC
[Mass-resetting default assignee, see bug 705890. Please reclaim this bug report by setting the assignee to yourself if you still plan to work on this. Thanks!]
Comment 4 Magdalen Berns (irc magpie) 2014-11-18 12:30:44 UTC
Ok just to update. This has been partially fixed.

Insert seems to be working fine but delete is still problematic. The output as things are is:

object:text-changed:insert(0, 1, a)
	source: [text | ]
	application: [application | Java Application]
object:text-changed:insert(1, 1, b)
	source: [text | ]
	application: [application | Java Application]
object:text-changed:insert(2, 1, c)
	source: [text | ]
	application: [application | Java Application]
object:text-changed:delete(2, 1, )
	source: [text | ]
	application: [application | Java Application]
object:text-changed:delete(1, 1, )
	source: [text | ]
	application: [application | Java Application]
object:text-changed:delete(0, 1, )
	source: [text | ]
	application: [application | Java Application]
Comment 5 Magdalen Berns (irc magpie) 2014-11-18 14:00:55 UTC
Yeah, essentially it's because the java AccessibleJTextComponent class method delete() doesn't directly translate to what's going on in ATK the way that insertTextAtIndex does[1,2]

So in java-atk-wrapper we have two methods which make use of the AccessibleJTextComponent methods :

	public void insert_text (String s, int position) {
		if (position < 0) {
			position = 0;
		}

		acc_edt_text.insertTextAtIndex(position, s);
	}

where the string s is the string being deleted and

	public void delete_text (int start, int end) {
		acc_edt_text.delete(start, end);
	}

Then in AtkWrapper.c these methods seem to be treated the same way so the problem is in figuring out how to get around the java API to get the information required and the question that follows is:

why is this data required for delete?

[1]https://docs.oracle.com/javase/8/docs/api/javax/swing/text/JTextComponent.AccessibleJTextComponent.html#delete
[2]https://docs.oracle.com/javase/8/docs/api/javax/swing/text/JTextComponent.AccessibleJTextComponent.html#insertTextAtIndex
Comment 6 Joanmarie Diggs (IRC: joanie) 2014-11-18 14:44:35 UTC
(In reply to comment #5)
> why is this data required for delete?

As mentioned in the opening report:

   Impact:
   * Orca cannot indicate to the user which character was just deleted.

Which screen readers are expected to do when you use BackSpace or Ctrl+BackSpace to remove text as confirmation of what you just got rid of.
Comment 7 Magdalen Berns (irc magpie) 2014-11-20 16:45:50 UTC
(In reply to comment #6)
> (In reply to comment #5)
> > why is this data required for delete?
> 
> As mentioned in the opening report:
> 
>    Impact:
>    * Orca cannot indicate to the user which character was just deleted.
> 
> Which screen readers are expected to do when you use BackSpace or
> Ctrl+BackSpace to remove text as confirmation of what you just got rid of.

That makes sense but on checking against gedit I'm not seeing the same results as are indicated in your initial report. Pehaps the API has changed since then?

It seems like the reason it is possible to obtain the string with insert is because the string to be inserted is in the argument.[1] This is not so on delete.[2] In other words, I think this might be an atk bug.

[1]https://developer.gnome.org/atk/unstable/AtkEditableText.html#atk-editable-text-insert-text
[2]https://developer.gnome.org/atk/unstable/AtkEditableText.html#atk-editable-text-delete-text
Comment 8 André Klapper 2015-02-27 16:56:23 UTC
[Moving at-spi/java-atk-wrapper bugs to separate product. See bug 740075]
Comment 9 Samuel Thibault 2019-05-20 19:33:27 UTC
I can still reproduce this: the changed-delete event now contains text, but it's the text that remains, not the text being deleted.
Comment 10 Samuel Thibault 2019-06-10 19:01:24 UTC
It seems like it's the openjdk implementation which is not providing the correct information. 

https://docs.oracle.com/javase/7/docs/api/javax/accessibility/AccessibleContext.html#ACCESSIBLE_TEXT_PROPERTY says:

“
For text insertion, the oldValue is null and the newValue is an AccessibleTextSequence specifying the text that was inserted.
For text deletion, the oldValue is an AccessibleTextSequence specifying the text that was deleted and the newValue is null.
For text replacement, the oldValue is an AccessibleTextSequence specifying the old text and the newValue is an AccessibleTextSequence specifying the new text.
”

but in e.g. openjdk 11's ./src/java.desktop/share/classes/javax/swing/text/JTextComponent.java we can read:

public void insertUpdate(DocumentEvent e) {
...
firePropertyChange(ACCESSIBLE_TEXT_PROPERTY, null, pos);
...
}

public void removeUpdate(DocumentEvent e) {
...
firePropertyChange(ACCESSIBLE_TEXT_PROPERTY, null, pos);
...
}

public void changedUpdate(DocumentEvent e) {
...
firePropertyChange(ACCESSIBLE_TEXT_PROPERTY, null, pos);
...
}

So it's always only providing a new value, and it's just the position while it should be the text.

So we need to get that fixed in openjdk first.
Comment 11 GNOME Infrastructure Team 2021-05-17 15:39:32 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/java-atk-wrapper/-/issues/8.