FF/Chrome/IE browseMode quicknav includes rich text widgets (contentEditable) in edit and formField commands#7461
Conversation
…efixed by 'parent::' which means that the parent node should be checked for this attribute, rather than this node.
… seems to incorrectly expose this. Not only is it incorrect info for the user, but it can affect jumping to editable elements with quicknav.
…elds) now include editable content (E.g. div with contentEditable=true).
…ields) now includes editable content (E.g. div contentEditable=true). Also read-only edit fields (I.e. <input type="text" readonly />) are again included.
| // A given attribute can contain a parent prefix, which means the parent node will be checked for that attribute instead of this one. | ||
| if(this->parent&&attribName->find(parentPrefix)==0) { | ||
| VBufStorage_attributeMap_t::const_iterator foundAttrib = this->parent->attributes.find(attribName->substr(parentPrefix.length())); | ||
| if (foundAttrib != this->parent->attributes.end()) |
There was a problem hiding this comment.
Please add braces for this line
| test << L";"; | ||
| } else { // not a parent attribute | ||
| VBufStorage_attributeMap_t::const_iterator foundAttrib = attributes.find(*attribName); | ||
| if (foundAttrib != attributes.end()) |
| @@ -149,13 +149,22 @@ inline void outputEscapedAttribute(wostringstream& out, const wstring& text) { | |||
|
|
|||
| bool VBufStorage_fieldNode_t::matchAttributes(const std::vector<std::wstring>& attribs, const std::wregex& regexp) { | |||
| wostringstream test; | |||
There was a problem hiding this comment.
Is this still necessary?
| outputEscapedAttribute(test, foundAttrib->second); | ||
| test << L";"; | ||
| // A given attribute can contain a parent prefix, which means the parent node will be checked for that attribute instead of this one. | ||
| if(this->parent&&attribName->find(parentPrefix)==0) { |
There was a problem hiding this comment.
So we cover parent:: at index 0, and npos, but not if it is later in the string. As we discussed could you add a comment to explain that its valid for the string to contain parent:: at other points in the string without it meaning that parent node needs to be checked for the attribute. An example of blah blah grandparent::
| {"IAccessible::role":[oleacc.ROLE_SYSTEM_COMBOBOX,oleacc.ROLE_SYSTEM_TEXT]}, | ||
| {"IAccessible::role":[oleacc.ROLE_SYSTEM_COMBOBOX]}, | ||
| # Focusable edit fields (input type=text, including readonly ones) | ||
| {"IAccessible::role":[oleacc.ROLE_SYSTEM_TEXT],"IAccessible::state_%s"%oleacc.STATE_SYSTEM_FOCUSABLE:[1]}, |
There was a problem hiding this comment.
As discussed I found this a little confusing to read. Specifically that STATE_SYTEM_FOCUSABLE belongs to the format string, and is the key to the value [1]. You could consider doing "IAccessible::state_{}".format(oleacc.STATE_SYSTEM_FOCUSABLE) : [1] instead.
| attrs={"IAccessible::role":[oleacc.ROLE_SYSTEM_TEXT,oleacc.ROLE_SYSTEM_COMBOBOX],"IAccessible::state_%s"%oleacc.STATE_SYSTEM_FOCUSABLE:[1],"IHTMLElement::isContentEditable":[1]} | ||
| attrs=[ | ||
| # Focusable edit fields (input type=text, including readonly ones) | ||
| {"IAccessible::role":[oleacc.ROLE_SYSTEM_TEXT],"IAccessible::state_%s"%oleacc.STATE_SYSTEM_FOCUSABLE:[1]}, |
There was a problem hiding this comment.
Since "IAccessible::state_%s"%oleacc.STATE_SYSTEM_FOCUSABLE is evaluated twice, could it instead be stored in a named variable?
|
I have done all the requested changes for storage.cpp.
However, I am reluctant to make the changes to the Python attribute
searching dictionaries, although I do agree in principle with them. We
have written those rules in that specific coding style for many years,
and I wouldn't want to change it only in one or two places. In the long
term I would be happy to consider a better coding style which we could
use for all of the rules.
|
|
Might we give an example editor, I.E. in wordpress in the whats new? |
Link to issue number:
Fixes #5534
Summary of the issue:
Rich text editors are becoming more prevalent on the web. Users expect that they can jump to these fields with NVDA quicknav commands they already know, such as e (edit) and f (formField).
These rich text editors are usually implemented either by a div with contentEditable="true" or sometimes an iframe with an embedded document set to design mode.
Description of how this pull request fixes the issue:
This PR makes it possible to jump to these rich text widgets with quick navigation in Firefox, Chrome and Internet Explorer.
In simple terms, quick navigation needs to locate the next element that is contentEditable, but whos parent is not contentEditable, as we do not wish to locate all descendants of the editable container.
To enable matching in this way, virtualBuffer searching attributes can now be prefixed with "parent::" which tells the buffer to check the parent node for that particular attribute, rather than the node it is actually looking at in the search. Which now means it is possible to construct a search that checks for contentEditable on a node, but a lack of contentEditable on its parent.
The quicknav search rules for Gecko and mshtml were updated to make use of this new parent prefix, so that they can locate top-most contentEditable nodes.
Testing performed:
Tested in Firefox, Chrome and IE testcases.zip:
Known issues with pull request:
This is not supported in Edge due to contentEditables not getting their own text pattern.
Change log entry:
What's new: