[orca] Fix bug causing some contenteditable text deletions to be	ignored
- From: Joanmarie Diggs <joanied src gnome org>
 
- To: commits-list gnome org
 
- Cc: 
 
- Subject: [orca] Fix bug causing some contenteditable text deletions to be	ignored
 
- Date: Tue,  3 Mar 2020 13:22:41 +0000 (UTC)
 
commit e5cc5f81f476fbc971648bec3ca58d9d872f4b1f
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Tue Mar 3 14:20:16 2020 +0100
    Fix bug causing some contenteditable text deletions to be ignored
    
    If the event wasn't for the locusOfFocus or a descendant thereof, we were
    ignoring it. We cannot count on this being the case in contenteditable
    content.
 src/orca/scripts/web/script.py           |  5 +++++
 src/orca/scripts/web/script_utilities.py | 11 +++++++++++
 2 files changed, 16 insertions(+)
---
diff --git a/src/orca/scripts/web/script.py b/src/orca/scripts/web/script.py
index 747360f85..db47bef06 100644
--- a/src/orca/scripts/web/script.py
+++ b/src/orca/scripts/web/script.py
@@ -2040,6 +2040,11 @@ class Script(default.Script):
             debug.println(debug.LEVEL_INFO, msg, True)
             return True
 
+        if self.utilities.textEventIsDueToDeletion(event):
+            msg = "WEB: Event believed to be due to editable text deletion"
+            debug.println(debug.LEVEL_INFO, msg, True)
+            return False
+
         if self.utilities.textEventIsDueToInsertion(event):
             msg = "WEB: Ignoring event believed to be due to text insertion"
             debug.println(debug.LEVEL_INFO, msg, True)
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index ba1f31f71..e4cd407e0 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -4055,6 +4055,17 @@ class Utilities(script_utilities.Utilities):
         debug.println(debug.LEVEL_INFO, msg, True)
         return rv
 
+    def textEventIsDueToDeletion(self, event):
+        if not self.inDocumentContent(event.source) \
+           or not event.source.getState().contains(pyatspi.STATE_EDITABLE):
+            return False
+
+        if self.isDeleteCommandTextDeletionEvent(event) \
+           or self.isBackSpaceCommandTextDeletionEvent(event):
+            return True
+
+        return False
+
     def textEventIsDueToInsertion(self, event):
         if not event.type.startswith("object:text-"):
             return False
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]