Skip to content

Commit

Permalink
Support ARIA role='mark' and html mark tag (#11436)
Browse files Browse the repository at this point in the history
* Upgrade IAccessible2 to commit cbc1f29631780  in order to get the IA2_ROLE_MARK constant.

* Add ROLE_MARKED_CONTENT to NVDA, which should represent marked (highlighted) content. Have speech and braille report its start and end within rich text if the report emphasis document formatting option is enabled. Map the IAccessible2 MARK role to the NVDA MARK role. This all means that the mark role will be reported in both Firefox and Chrome.

* Fix linting issues

* Support role=mark in Internet Explorer and standardize support for HTML mark tag with Firefox / Chrome.

* Add a new 'report highlight' option to NVDA's document formatting settings, on by default, and have marked content be affected by that option rather than report emphasis.

* Address linting issues

* Gui: rename option in document formatting from Highlighting to Marked (highlighting).
UserGuide: mention the braille abbreviation for marked content.

* Update what's new
  • Loading branch information
michaelDCurran authored Jul 30, 2020
1 parent 10976a7 commit 39606f1
Show file tree
Hide file tree
Showing 14 changed files with 31 additions and 5 deletions.
2 changes: 1 addition & 1 deletion include/ia2
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ For reference, the following run time dependencies are included in Git submodule
* [wxPython](https://www.wxpython.org/), version 4.0.3
* [eSpeak NG](https://github.com/espeak-ng/espeak-ng), version 1.51-dev commit 1fb68ffffea4
* [Sonic](https://github.com/waywardgeek/sonic), commit 4f8c1d11
* [IAccessible2](https://wiki.linuxfoundation.org/accessibility/iaccessible2/start), commit 21bbb176
* [IAccessible2](https://wiki.linuxfoundation.org/accessibility/iaccessible2/start), commit cbc1f29631780
* [ConfigObj](https://github.com/DiffSK/configobj), commit f9a265c
* [Six](https://pypi.python.org/pypi/six), version 1.12.0, required by wxPython and ConfigObj
* [liblouis](http://www.liblouis.org/), version 3.14.0
Expand Down
2 changes: 2 additions & 0 deletions source/IAccessibleHandler/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
IA2_ROLE_BLOCK_QUOTE,
IA2_ROLE_DESKTOP_ICON,
IA2_ROLE_FOOTER,
IA2_ROLE_MARK,
)

from . import internalWinEventHandler
Expand Down Expand Up @@ -256,6 +257,7 @@
IA2_ROLE_CONTENT_INSERTION: controlTypes.ROLE_INSERTED_CONTENT,
IA2_ROLE_BLOCK_QUOTE: controlTypes.ROLE_BLOCKQUOTE,
IA2.IA2_ROLE_LANDMARK: controlTypes.ROLE_LANDMARK,
IA2_ROLE_MARK: controlTypes.ROLE_MARKED_CONTENT,
# some common string roles
"frame": controlTypes.ROLE_FRAME,
"iframe": controlTypes.ROLE_INTERNALFRAME,
Expand Down
1 change: 1 addition & 0 deletions source/NVDAObjects/IAccessible/MSHTML.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ def __contains__(self,item):
"ARTICLE": controlTypes.ROLE_ARTICLE,
"FIGURE": controlTypes.ROLE_FIGURE,
"FIGCAPTION": controlTypes.ROLE_CAPTION,
"MARK": controlTypes.ROLE_MARKED_CONTENT,
}


Expand Down
2 changes: 2 additions & 0 deletions source/aria.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"list":controlTypes.ROLE_LIST,
"listbox":controlTypes.ROLE_LIST,
"listitem":controlTypes.ROLE_LISTITEM,
"mark": controlTypes.ROLE_MARKED_CONTENT,
"menu":controlTypes.ROLE_POPUPMENU,
"menubar":controlTypes.ROLE_MENUBAR,
"menuitem":controlTypes.ROLE_MENUITEM,
Expand Down Expand Up @@ -100,4 +101,5 @@
"aside": "complementary",
"dialog": "dialog",
"figure": "figure",
"mark": "mark",
}
2 changes: 2 additions & 0 deletions source/braille.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@
controlTypes.ROLE_REGION: _("rgn"),
# Translators: Displayed in braille for an object which is a figure.
controlTypes.ROLE_FIGURE: _("fig"),
# Translators: Displayed in braille for an object which represents marked (highlighted) content
controlTypes.ROLE_MARKED_CONTENT: _("mrkd"),
}

positiveStateLabels = {
Expand Down
1 change: 1 addition & 0 deletions source/config/configSpec.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@
reportFontAttributes = boolean(default=false)
reportRevisions = boolean(default=true)
reportEmphasis = boolean(default=false)
reportHighlight = boolean(default=true)
reportSuperscriptsAndSubscripts = boolean(default=false)
reportColor = boolean(default=False)
reportAlignment = boolean(default=false)
Expand Down
3 changes: 3 additions & 0 deletions source/controlTypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@
ROLE_ARTICLE = 150
ROLE_REGION = 151
ROLE_FIGURE = 152
ROLE_MARKED_CONTENT = 153

STATE_UNAVAILABLE=0X1
STATE_FOCUSED=0X2
Expand Down Expand Up @@ -503,6 +504,8 @@
ROLE_REGION: _("region"),
# Translators: Identifies a figure (commonly seen on some websites).
ROLE_FIGURE: _("figure"),
# Translators: Identifies marked (highlighted) content
ROLE_MARKED_CONTENT: _("marked content"),
}

stateLabels: Dict[int, str] = {
Expand Down
11 changes: 11 additions & 0 deletions source/gui/settingsDialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1991,6 +1991,16 @@ def makeSettings(self, settingsSizer):
self.emphasisCheckBox=fontGroup.addItem(wx.CheckBox(self,label=emphasisText))
self.emphasisCheckBox.SetValue(config.conf["documentFormatting"]["reportEmphasis"])

# Translators: This is the label for a checkbox in the
# document formatting settings panel.
highlightText = _("Marked (highlighted text)")
self.highlightCheckBox = fontGroup.addItem(
wx.CheckBox(self, label=highlightText)
)
self.highlightCheckBox.SetValue(
config.conf["documentFormatting"]["reportHighlight"]
)

# Translators: This is the label for a checkbox in the
# document formatting settings panel.
styleText =_("St&yle")
Expand Down Expand Up @@ -2205,6 +2215,7 @@ def onSave(self):
config.conf["documentFormatting"]["reportComments"]=self.commentsCheckBox.IsChecked()
config.conf["documentFormatting"]["reportRevisions"]=self.revisionsCheckBox.IsChecked()
config.conf["documentFormatting"]["reportEmphasis"]=self.emphasisCheckBox.IsChecked()
config.conf["documentFormatting"]["reportHighlight"] = self.highlightCheckBox.IsChecked()
config.conf["documentFormatting"]["reportAlignment"]=self.alignmentCheckBox.IsChecked()
config.conf["documentFormatting"]["reportStyle"]=self.styleCheckBox.IsChecked()
config.conf["documentFormatting"]["reportSpellingErrors"]=self.spellingErrorsCheckBox.IsChecked()
Expand Down
2 changes: 1 addition & 1 deletion source/speech/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2112,7 +2112,7 @@ def getFormatFieldSpeech( # noqa: C901
# Translators: Reported when text is not revised.
text = _("no revised %s") % oldRevision
textList.append(text)
if formatConfig["reportEmphasis"]:
if formatConfig["reportHighlight"]:
# marked text
marked=attrs.get("marked")
oldMarked=attrsCache.get("marked") if attrsCache is not None else None
Expand Down
2 changes: 2 additions & 0 deletions source/textInfos/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ def getPresentationCategory(self, ancestors, formatConfig, reason=controlTypes.R
or (role in (controlTypes.ROLE_TABLE, controlTypes.ROLE_TABLECELL, controlTypes.ROLE_TABLEROWHEADER, controlTypes.ROLE_TABLECOLUMNHEADER) and not formatConfig["reportTables"])
or (role in (controlTypes.ROLE_LIST, controlTypes.ROLE_LISTITEM) and controlTypes.STATE_READONLY in states and not formatConfig["reportLists"])
or (role == controlTypes.ROLE_ARTICLE and not formatConfig["reportArticles"])
or (role == controlTypes.ROLE_MARKED_CONTENT and not formatConfig["reportHighlight"])
or (role in (controlTypes.ROLE_FRAME, controlTypes.ROLE_INTERNALFRAME) and not formatConfig["reportFrames"])
or (role in (controlTypes.ROLE_DELETED_CONTENT,controlTypes.ROLE_INSERTED_CONTENT) and not formatConfig["reportRevisions"])
or (
Expand Down Expand Up @@ -145,6 +146,7 @@ def getPresentationCategory(self, ancestors, formatConfig, reason=controlTypes.R
controlTypes.ROLE_POPUPMENU,
controlTypes.ROLE_TABLE,
controlTypes.ROLE_ARTICLE,
controlTypes.ROLE_MARKED_CONTENT,
)
or (role == controlTypes.ROLE_EDITABLETEXT and (
controlTypes.STATE_READONLY not in states
Expand Down
2 changes: 0 additions & 2 deletions source/virtualBuffers/MSHTML.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ def _normalizeFormatField(self, attrs):
attrs['revision-insertion']=True
if formatState&FORMATSTATE_DELETED:
attrs['revision-deletion']=True
if formatState&FORMATSTATE_MARKED:
attrs['marked']=True
if formatState&FORMATSTATE_STRONG:
attrs['strong']=True
if formatState&FORMATSTATE_EMPH:
Expand Down
2 changes: 2 additions & 0 deletions user_docs/en/changes.t2t
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ What's New in NVDA
- You can now toggle NVDA's touchscreen support. An option has been added to the Touch Interaction panel of NVDA's settings. The default gesture is NVDA+control+alt+t. (#9682)
- Added new German braille tables. (#11268)
- NVDA now detects read-only text UIA controls. (#10494)
- The existence of marked (highlighted) content is reported in both speech and braille in all web browsers. (#11436)
- This can be toggled on and off by a new NVDA Document Formatting option for Highlighting.


== Changes ==
Expand Down
2 changes: 2 additions & 0 deletions user_docs/en/userGuide.t2t
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,7 @@ In order to fit as much information as possible on a braille display, the follow
| lv N | a tree view item has a hierarchical level N|
| wnd | window |
| ⠤⠤⠤⠤⠤ | separator |
| mrkd | marked content |

The following state indicators are also defined:
|| Abbreviation | Control state |
Expand Down Expand Up @@ -1732,6 +1733,7 @@ You can configure reporting of:
- Font attributes
- Superscripts and subscripts
- Emphasis
- Marked (Highlighted text)
- Style
- Colours
- Document information
Expand Down

0 comments on commit 39606f1

Please sign in to comment.