Problem with editable text fields which update their value when the focus changes #220

Closed
nvaccessAuto opened this Issue Jan 1, 2010 · 8 comments

2 participants

@nvaccessAuto

Reported by jteh on 2008-11-05 14:58
Some web sites use a technique whereby they present the label of an editable text field in its value:

  • The value of the field defaults to the label.
  • When the field gains focus, the value is cleared.
  • When the field loses focus, if the value is empty, it is set back to the label. The practical upshot is that the field will contain its label if it is empty, but otherwise, it will show the value entered by the user. This is problematic for accessibility anyway, but nevertheless, several sites do this.

Unfortunately, this is particularly problematic for NVDA. NVDA sets the focus to fields as the user moves to them with the cursor keys or quick navigation. The resulting focus event is normally ignored because the virtual caret is already in the field, so NVDA knows that the focus change was caused by the caret movement. However, if a prior element on the page updates during the focus change (as is the case with this technique), the virtual caret will not be in the field because the field wil move in the buffer as a result of the focus change. Thus, NVDA will not ignore the focus event.

This is particularly bad if "Automatic focus mode for focus changes" is enabled because, upon receiving the focus event, NVDA will then activate focus mode, even though the user might have actually moved there using cursor keys or quick navigation.

Steps to Reproduce

  1. Ensure that "Automatic focus mode for focus changes" is enabled.
  2. Open the attached test case.
  3. Ensure you are at the top of the document by pressing ctrl+home.
  4. Press e twice to move to the second edit field.

Actual Results

Focus mode will be automatically enabled upon landing in the second edit field.

Expected Results

Focus mode should not be automatically enabled.

Additional Information

@nvaccessAuto

Attachment test_label_as_edit_field_value.html added by jteh on 2008-11-05 15:00
Description:
Test case containing two editable text fields with the labels in their values.

@nvaccessAuto

Comment 1 by Iris on 2008-11-06 05:50
To add to this, I've noticed that NVDA, which previously did, no longer work with edit boxes found in IFrames, if that makes sense.

Attached is the log that I got for that particular occurence on Wordpress.com
Iris


INFO - nvda (22:29:32):
Starting NVDA
INFO - config.save (22:29:32):
Configuration saved
INFO - core.main (22:29:32):
NVDA version trunk-r2479
INFO - core.main (22:29:32):
Using Windows version (5, 1, 2600, 2, 'Service Pack 3')
INFO - core.main (22:29:32):
Using Python version 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) v.1310 32 bit (Intel)
INFO - core.main (22:29:32):
Using comtypes version 0.4.2
INFO - synthDriverHandler.setSynth (22:29:33):
Loaded synthDriver espeak
INFO - core.main (22:29:33):
Using wx version 2.8.7.1 (msw-unicode)
INFO - braille.initialize (22:29:33):
Using liblouis version liblouis-1.3.9, September 17, 2008.
INFO - braille.BrailleHandler.setDisplayByName (22:29:33):
Loaded braille display driver noBraille
INFO - appModuleHandler.initialize (22:29:33):
loaded default appModule
INFO - appModuleHandler.getAppModuleFromProcessID (22:29:33):
Loaded appModule winamp
INFO - core.main (22:29:33):
NVDA initialized
INFO - appModuleHandler.getAppModuleFromProcessID (22:29:43):
Loaded appModule firefox
INFO - appModuleHandler.getAppModuleFromProcessID (22:31:29):
Loaded appModule nvda
INFO - appModuleHandler.getAppModuleFromProcessID (22:31:38):
Loaded appModule skype
ERROR - queueHandler.flushQueue (22:31:43):
Error in func queueScriptCallback from eventQueue
Traceback (most recent call last):
File "C:\Documents and Settings\Iris Pang\My Documents\NVDA\trunk\source\queueHandler.py", line 53, in flushQueue
func(args,*kwargs)
File "C:\Documents and Settings\Iris Pang\My Documents\NVDA\trunk\source\scriptHandler.py", line 74, in queueScriptCallback
executeScript(script,keyPress)
File "C:\Documents and Settings\Iris Pang\My Documents\NVDA\trunk\source\scriptHandler.py", line 105, in executeScript
script(keyPress)
File "C:\Documents and Settings\Iris Pang\My Documents\NVDA\trunk\source\cursorManager.py", line 126, in script_moveByLine_back
self._caretMovementScriptHelper(textHandler.UNIT_LINE,-1)
File "C:\Documents and Settings\Iris Pang\My Documents\NVDA\trunk\source\virtualBuffers__init
.py", line 249, in caretMovementScriptHelper
super(VirtualBuffer, self).caretMovementScriptHelper(args, *kwargs)
File "C:\Documents and Settings\Iris Pang\My Documents\NVDA\trunk\source\cursorManager.py", line 63, in _caretMovementScriptHelper
info.expand(unit)
File "C:\Documents and Settings\Iris Pang\My Documents\NVDA\trunk\source\NVDAObjects__init
.py", line 183, in expand
self.startOffset,self.endOffset=self._getUnitOffsets(unit,self._startOffset)
File "C:\Documents and Settings\Iris Pang\My Documents\NVDA\trunk\source\virtualBuffers__init
.py", line 126, in getUnitOffsets
return super(VirtualBufferTextInfo, self).getUnitOffsets(unit, offset)
File "C:\Documents and Settings\Iris Pang\My Documents\NVDA\trunk\source\NVDAObjects__init
.py", line 137, in getUnitOffsets
return offsetsFunc(offset)
File "C:\Documents and Settings\Iris Pang\My Documents\NVDA\trunk\source\virtualBuffers__init_
.py", line 91, in getLineOffsets
return VBufClient_getBufferLineOffsets(self.obj.VBufHandle,offset,config.conf[ File "C:\Documents and Settings\Iris Pang\My Documents\NVDA\trunk\source\virtualBuffer_lib.py", line 103, in VBufClient_getBufferLineOffsets
dll.VBufClient_getBufferLineOffsets(buf,offset,maxLineLength,cUseScreenLayout,byref(startOffset),byref(endOffset))
File "C:\Documents and Settings\Iris Pang\My Documents\NVDA\trunk\source\virtualBuffer_lib.py", line 17, in dllErrorCheck
raise RuntimeError("error in %s with args of %s"%(func.name,args))
RuntimeError: error in VBufClient_getBufferLineOffsets with args of (14433536, 1531, 100, 1, , )
ERROR - queueHandler.flushQueue (22:31:44):
Error in func queueScriptCallback from eventQueue
Traceback (most recent call last):
File "C:\Documents and Settings\Iris Pang\My Documents\NVDA\trunk\source\queueHandler.py", line 53, in flushQueue
func(args,*kwargs)
File "C:\Documents and Settings\Iris Pang\My Documents\NVDA\trunk\source\scriptHandler.py", line 74, in queueScriptCallback
executeScript(script,keyPress)
File "C:\Documents and Settings\Iris Pang\My Documents\NVDA\trunk\source\scriptHandler.py", line 105, in executeScript
script(keyPress)
File "C:\Documents and Settings\Iris Pang\My Documents\NVDA\trunk\source\cursorManager.py", line 129, in script_moveByLine_forward
self._caretMovementScriptHelper(textHandler.UNIT_LINE,1)
File "C:\Documents and Settings\Iris Pang\My Documents\NVDA\trunk\source\virtualBuffers__init
.py", line 249, in caretMovementScriptHelper
super(VirtualBuffer, self).caretMovementScriptHelper(args, *kwargs)
File "C:\Documents and Settings\Iris Pang\My Documents\NVDA\trunk\source\cursorManager.py", line 63, in _caretMovementScriptHelper
info.expand(unit)
File "C:\Documents and Settings\Iris Pang\My Documents\NVDA\trunk\source\NVDAObjects__init
.py", line 183, in expand
self.startOffset,self.endOffset=self._getUnitOffsets(unit,self._startOffset)
File "C:\Documents and Settings\Iris Pang\My Documents\NVDA\trunk\source\virtualBuffers__init
.py", line 126, in getUnitOffsets
return super(VirtualBufferTextInfo, self).getUnitOffsets(unit, offset)
File "C:\Documents and Settings\Iris Pang\My Documents\NVDA\trunk\source\NVDAObjects__init
.py", line 137, in getUnitOffsets
return offsetsFunc(offset)
File "C:\Documents and Settings\Iris Pang\My Documents\NVDA\trunk\source\virtualBuffers__init_
.py", line 91, in getLineOffsets
return VBufClient_getBufferLineOffsets(self.obj.VBufHandle,offset,config.conf"virtualBuffers"
)[ File "C:\Documents and Settings\Iris Pang\My Documents\NVDA\trunk\source\virtualBuffer_lib.py", line 103, in VBufClient_getBufferLineOffsets
dll.VBufClient_getBufferLineOffsets(buf,offset,maxLineLength,cUseScreenLayout,byref(startOffset),byref(endOffset))
File "C:\Documents and Settings\Iris Pang\My Documents\NVDA\trunk\source\virtualBuffer_lib.py", line 17, in dllErrorCheck
raise RuntimeError("error in %s with args of %s"%(func.name,args))
RuntimeError: error in VBufClient_getBufferLineOffsets with args of (14433536, 1531, 100, 1, , )
ERROR - queueHandler.flushQueue (22:31:44):
Error in func queueScriptCallback from eventQueue
Traceback (most recent call last):
File "C:\Documents and Settings\Iris Pang\My Documents\NVDA\trunk\source\queueHandler.py", line 53, in flushQueue
func(args,*kwargs)
File "C:\Documents and Settings\Iris Pang\My Documents\NVDA\trunk\source\scriptHandler.py", line 74, in queueScriptCallback
executeScript(script,keyPress)
File "C:\Documents and Settings\Iris Pang\My Documents\NVDA\trunk\source\scriptHandler.py", line 105, in executeScript
script(keyPress)
File "C:\Documents and Settings\Iris Pang\My Documents\NVDA\trunk\source\cursorManager.py", line 129, in script_moveByLine_forward
self._caretMovementScriptHelper(textHandler.UNIT_LINE,1)
File "C:\Documents and Settings\Iris Pang\My Documents\NVDA\trunk\source\virtualBuffers__init
.py", line 249, in caretMovementScriptHelper
super(VirtualBuffer, self).caretMovementScriptHelper(args, *kwargs)
File "C:\Documents and Settings\Iris Pang\My Documents\NVDA\trunk\source\cursorManager.py", line 63, in _caretMovementScriptHelper
info.expand(unit)
File "C:\Documents and Settings\Iris Pang\My Documents\NVDA\trunk\source\NVDAObjects__init
.py", line 183, in expand
self.startOffset,self.endOffset=self._getUnitOffsets(unit,self._startOffset)
File "C:\Documents and Settings\Iris Pang\My Documents\NVDA\trunk\source\virtualBuffers__init
.py", line 126, in getUnitOffsets
return super(VirtualBufferTextInfo, self).getUnitOffsets(unit, offset)
File "C:\Documents and Settings\Iris Pang\My Documents\NVDA\trunk\source\NVDAObjects__init
.py", line 137, in getUnitOffsets
return offsetsFunc(offset)
File "C:\Documents and Settings\Iris Pang\My Documents\NVDA\trunk\source\virtualBuffers__init_
.py", line 91, in _getLineOffsets
return VBufClient_getBufferLineOffsets(self.obj.VBufHandle,offset,config.conf"virtualBuffers"
)["maxLineLength"],config.conf["virtualBuffers"]["useScreenLayout"])
File "C:\Documents and Settings\Iris Pang\My Documents\NVDA\trunk\source\virtualBuffer_lib.py", line 103, in VBufClient_getBufferLineOffsets
dll.VBufClient_getBufferLineOffsets(buf,offset,maxLineLength,cUseScreenLayout,byref(startOffset),byref(endOffset))
File "C:\Documents and Settings\Iris Pang\My Documents\NVDA\trunk\source\virtualBuffer_lib.py", line 17, in dllErrorCheck
raise RuntimeError("error in %s with args of %s"%(func.__name,args))
RuntimeError: error in VBufClient_getBufferLineOffsets with args of (14433536, 1531, 100, 1, , )
ERROR - queueHandler.flushQueue (22:43:36):
Error in func queueScriptCallback from eventQueue
Traceback (most recent call last):
File "C:\Documents and Settings\Iris Pang\My Documents\NVDA\trunk\source\queueHandler.py", line 53, in flushQueue
func(args,*kwargs)
File "C:\Documents and Settings\Iris Pang\My Documents\NVDA\trunk\source\scriptHandler.py", line 74, in queueScriptCallback
executeScript(script,keyPress)
File "C:\Documents and Settings\Iris Pang\My Documents\NVDA\trunk\source\scriptHandler.py", line 105, in executeScript
script(keyPress)
File "appModules_default.py", line 518, in script_review_moveToCaret
info=api.getReviewPosition().obj.makeTextInfo(textHandler.POSITION_CARET)
File "C:\Documents and Settings\Iris Pang\My Documents\NVDA\trunk\source\NVDAObjects__init
.py", line 710, in makeTextInfo
return self.TextInfo(self,position)
File "C:\Documents and Settings\Iris Pang\My Documents\NVDA\trunk\source\NVDAObjects__init__.py", line 155, in init
self.startOffset=self.endOffset=self._getCaretOffset()
File "C:\Documents and Settings\Iris Pang\My Documents\NVDA\trunk\source\NVDAObjects__init
.py", line 44, in getCaretOffset
return self.obj.basicCaretOffset
File "C:\Documents and Settings\Iris Pang\My Documents\NVDA\trunk\source\baseObject.py", line 23, in __getattr_

return getattr(self,'get%s'%name)()
File "C:\Documents and Settings\Iris Pang\My Documents\NVDA\trunk\source\NVDAObjects__init__.py", line 698, in get_basicCaretOffset
raise NotImplementedError
NotImplementedError
ERROR - queueHandler.flushQueue (22:43:37):
Error in func queueScriptCallback from eventQueue
Traceback (most recent call last):
File "C:\Documents and Settings\Iris Pang\My Documents\NVDA\trunk\source\queueHandler.py", line 53, in flushQueue
func(args,*kwargs)
File "C:\Documents and Settings\Iris Pang\My Documents\NVDA\trunk\source\scriptHandler.py", line 74, in _queueScriptCallback
executeScript(script,keyPress)
File "C:\Documents and Settings\Iris Pang\My Documents\NVDA\trunk\source\scriptHandler.py", line 105, in executeScript
script(keyPress)
File "appModules_default.py", line 518, in script_review_moveToCaret
info=api.getReviewPosition().obj.makeTextInfo(textHandler.POSITION_CARET)
File "C:\Documents and Settings\Iris Pang\My Documents\NVDA\trunk\source\NVDAObjects__init
.py", line 710, in makeTextInfo
return self.TextInfo(self,position)
File "C:\Documents and Settings\Iris Pang\My Documents\NVDA\trunk\source\NVDAObjects__init__.py", line 155, in init
self.startOffset=self.endOffset=self._getCaretOffset()
File "C:\Documents and Settings\Iris Pang\My Documents\NVDA\trunk\source\NVDAObjects__init
.py", line 44, in getCaretOffset
return self.obj.basicCaretOffset
File "C:\Documents and Settings\Iris Pang\My Documents\NVDA\trunk\source\baseObject.py", line 23, in __getattr_

return getattr(self,'get%s'%name)()
File "C:\Documents and Settings\Iris Pang\My Documents\NVDA\trunk\source\NVDAObjects__init__.py", line 698, in _get_basicCaretOffset
raise NotImplementedError
NotImplementedError

@nvaccessAuto

Comment 2 by jteh (in reply to comment 1) on 2008-11-06 07:00
Replying to Iris:

To add to this, I've noticed that NVDA, which previously did, no longer work with edit boxes found in IFrames, if that makes sense.

It doesn't. :) I think this is a different bug, so please open another ticket and provide exact steps to reproduce. Btw, when including preformatted text like log files, either attach a file or enclose them in !and markers on separate lines.

@nvaccessAuto

Comment 3 by jteh on 2008-11-06 07:03
The solution for this bug is to make sure that the virtual caret is adjusted so that it remains within the node in which it previously resided when an event occurs. This needs to be done in the virtual buffer library. This will probably be done during the refactor.

@nvaccessAuto

Comment 4 by jteh on 2009-05-18 07:27
My previously proposed fix will cause problems for nodes which are removed and then immediately replaced; e.g. scoreboard with constantly updating scores.

Better solution: Only update caret offset if it is outside the updated zone, otherwise leave it alone.
Changes:
Milestone changed from None to 0.6

@nvaccessAuto

Comment 5 by jteh on 2009-06-17 07:20
Fix committed by Mick in nvVBufLib main revision 118. Note that neither of the solutions above were used in the end. :) This should be closed once this build makes it into misc-deps.

@nvaccessAuto

Comment 6 by jteh on 2009-06-25 00:39
Awaiting new misc-deps.

@nvaccessAuto

Comment 7 by jteh on 2009-06-25 02:36
Fixed in new misc-deps; see r3019.
Changes:
State: closed

@jcsteh jcsteh was assigned by nvaccessAuto Nov 10, 2015
@nvaccessAuto nvaccessAuto added this to the 2009.1 milestone Nov 10, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment