Skip to content

FF/Chrome/IE browseMode quicknav includes rich text widgets (contentEditable) in edit and formField commands#7461

Merged
michaelDCurran merged 5 commits into
masterfrom
i5534
Aug 29, 2017
Merged

FF/Chrome/IE browseMode quicknav includes rich text widgets (contentEditable) in edit and formField commands#7461
michaelDCurran merged 5 commits into
masterfrom
i5534

Conversation

@michaelDCurran

Copy link
Copy Markdown
Member

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:

  • content_editable.html: made sure that both e and f found the editable section.
  • designMode.html: made sure that both e and f found the editable document.
  • formFields.html: made sure that e and f found all the edit fields, including the read-only one.

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:

…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.
Comment thread nvdaHelper/vbufBase/storage.cpp Outdated
// 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())

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add braces for this line

Comment thread nvdaHelper/vbufBase/storage.cpp Outdated
test << L";";
} else { // not a parent attribute
VBufStorage_attributeMap_t::const_iterator foundAttrib = attributes.find(*attribName);
if (foundAttrib != attributes.end())

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also on this line

Comment thread nvdaHelper/vbufBase/storage.cpp Outdated
@@ -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;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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]},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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]},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since "IAccessible::state_%s"%oleacc.STATE_SYSTEM_FOCUSABLE is evaluated twice, could it instead be stored in a named variable?

@michaelDCurran

michaelDCurran commented Aug 1, 2017 via email

Copy link
Copy Markdown
Member Author

michaelDCurran added a commit that referenced this pull request Aug 2, 2017
@derekriemer

Copy link
Copy Markdown
Collaborator

Might we give an example editor, I.E. in wordpress in the whats new?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Single letter navigation to editable text fields should include rich text editors

4 participants