Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XWIKI-19723: Navigation panel not accessible using a screen reader #3789

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
'filterByClass': '',
'filterHiddenDocuments': true,
'hierarchyMode': 'reference',
'id': 'document',
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this is the right place. The comment above says:

Configuration options for the Document Tree Source (that is used to retrieve the tree nodes).

We don't need the id to retrieve the tree nodes. The proper place is rather https://github.com/xwiki/xwiki-platform/blob/master/xwiki-platform-core/xwiki-platform-tree/xwiki-platform-tree-war/src/main/webapp/templates/tree_macros.vm#L20 (that's where we set the default CSS class for instance).

As for the default id value, since we can't easily have a counter, I think we can use a random value. Here's an example https://github.com/xwiki/xwiki-platform/blob/master/xwiki-platform-core/xwiki-platform-ckeditor/xwiki-platform-ckeditor-ui/src/main/resources/CKEditor/FileUploader.xml#L88 (timestamp + small random). I'd go with:

'id': "xtree-${datetool.date.time}-${mathtool.random(100, 1000)}",

'limit': 15,
'root': '',
'rootData': {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ rendering.macro.tree.parameter.finder.description=Show a text input that can be
rendering.macro.tree.parameter.limit.name=Limit
rendering.macro.tree.parameter.limit.description=The maximum number of child nodes to display when expanding a parent node for the first time. The rest of the child nodes are accessible through a "more ..." link. This parameter is basically used to paginate the child nodes and thus helps the tree scale when the number of child nodes is large. The tree passes this parameter to the tree source so it works only with dynamic trees whose source implements child count limit.
rendering.macro.tree.content.description=You can use nested HTML unordered lists to describe the tree structure. See http://www.jstree.com/docs/html/ for more information.
tree.macro.editModeWarning=This tree can't be displayed in edit mode.</content>
tree.macro.editModeWarning=This tree can't be displayed in edit mode.
tree.macro.description=Expand and collapse this tree nodes respectively with the right and left arrow keys. Navigate between the nodes with the up and down arrow keys.</content>
<object>
<name>Macros.TreeTranslations</name>
<number>0</number>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@

#macro (tree $options)
<div #treeAttributes($options)></div>
<span id="xtree#if($!{macro.options.id})-$!{macro.options.id}#{end}-description" class="sr-only">
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we should force an ID prefix. The default ID can have a prefix (see my other comment), but if the user specifies an ID, we should use it as is, i.e. we should only add the -description suffix.

$services.localization.render('tree.macro.description')
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
$services.localization.render('tree.macro.description')
$escapetool.xml($services.localization.render('tree.macro.description'))

</span>
#end

#macro (treeAttributes $options $isWikiSyntax)
Expand All @@ -62,14 +65,14 @@
$entry.key = "$escapedValue"##
#end
#end

#macro (getTreeAttributes $options $attributes)
#set ($macro.options = {})
#set ($discard = $macro.options.putAll($defaultTreeOptions))
#set ($discard = $macro.options.putAll($options))
#if ($macro.options.id)
#set ($discard = $attributes.put('id', $macro.options.id))
#end
#set ($discard = $attributes.put('aria-describedby', "xtree#if($!{macro.options.id})-$!{macro.options.id}#{end}-description"))
#set ($classes = ["$!macro.options.get('class')"])
#set ($noLinks = $macro.options.links != 'true')
#if ($noLinks)
Expand Down