diff --git a/source/browseMode.py b/source/browseMode.py index c61f7123e7c..e173a8f6b76 100644 --- a/source/browseMode.py +++ b/source/browseMode.py @@ -1999,6 +1999,12 @@ def event_gainFocus(self, obj, nextHandler): # and this was the last non-root node with focus, so ignore this focus event. # Otherwise, if the user switches away and back to this document, the cursor will jump to this node. # This is not ideal if the user was positioned over a node which cannot receive focus. + # #17501: Even though we're ignoring this event, we still need to call + # _postGainFocus. This does things such as initialize auto select detection + # for editable text controls. Without this, the focus object might not + # behave correctly (e.g. text selection changes might not be reported) if the + # user switches to focus mode with this object still focused. + self._postGainFocus(obj) return if obj == self.rootNVDAObject: if self.passThrough: diff --git a/user_docs/en/changes.md b/user_docs/en/changes.md index d318f881d10..cdf5fe1d541 100644 --- a/user_docs/en/changes.md +++ b/user_docs/en/changes.md @@ -76,6 +76,7 @@ Specifically, MathML inside of span and other elements that have the attribute ` * In Notepad and other UIA documents, and Notepad++ documents on Windows 11, if the last line is empty, the "braille next line command" will move the cursor to the last line. In any document, if the cursor is on the last line, it will be moved to the end when using this command. (#17251, #17430, @nvdaes) +* In web browsers, changes to text selection no longer sometimes fail to be reported in editable text controls. (#17501, @jcsteh) ### Changes for Developers